Page 1 of 1

My First Post - Hello

Posted: Wed Dec 03, 2025 6:36 pm
by MikeGreen99
Ubuntu Unity 24.04 PureBasic 6.21

Hi.

I am a retired electrical engineer who made a career designing and programming computer systems. I have 'played' with Visual Basic and QuickBasic for many years. I have dabbled in assembler, C, and the mighty Python. Now I'm toying with PureBasic, and I really like it. It will become my go to language for most of my future programming needs.

By the way, I had difficulties registering for this forum. The system would not accept my entered info. I tried multiple times. Finally, I tried disabling Privacy Badger, and it worked. Go figure.

Have a nice day,
Mike from the 1000 Islands, Ontario, Canada

Re: My First Post - Hello

Posted: Wed Dec 03, 2025 6:53 pm
by miso
Welcome, good to have you here ;)

Re: My First Post - Hello

Posted: Wed Dec 03, 2025 6:57 pm
by mk-soft
Wellcome ;)

I've been with PureBasic for over 20 years. Some programs and services have been running on various systems for a very long time.
It's worth working with it. Even if you first have to learn that a few things go differently than you were used to with VB6.

P.S.
Before you work with the FormDesigner you should write the windows and gadgets by hand.
Since every start is difficult to understand the event management of PureBasic I have put my template to test.

Code: Select all

;-TOP

#ProgramTitle = "Main Window"
#ProgramVersion = "v1.01.2"

Enumeration Windows
  #Main
EndEnumeration

Enumeration MenuBar
  #MainMenu
EndEnumeration

Enumeration MenuItems
  #MainMenuAbout
  #MainMenuExit
EndEnumeration

Enumeration Gadgets
  #MainEdit
  #MainButtonOk
  #MainButtonCancel
EndEnumeration

Enumeration StatusBar
  #MainStatusBar
EndEnumeration

Procedure UpdateWindow()
  Protected dx, dy
  dx = WindowWidth(#Main)
  dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar) - MenuHeight()
  ; Resize gadgets
  ResizeGadget(#MainEdit, 5, 5, dx - 10, dy - 45)
  ResizeGadget(#MainButtonok, 10, dy - 35, 120, 30)
  ResizeGadget(#MainButtonCancel, dx - 130, dy - 35, 120, 30)
EndProcedure

Procedure Main()
  Protected dx, dy
  
  #MainStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
  
  If OpenWindow(#Main, #PB_Ignore, #PB_Ignore, 800, 600, #ProgramTitle , #MainStyle)
    ; Menu
    CreateMenu(#MainMenu, WindowID(#Main))
    MenuTitle("&File")
    CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
      MenuItem(#PB_Menu_About, "")
    CompilerElse
      MenuItem(#MainMenuAbout, "About")
    CompilerEndIf
    ; Menu File Items
    
    CompilerIf Not #PB_Compiler_OS = #PB_OS_MacOS
      MenuBar()
      MenuItem(#MainMenuExit, "E&xit")
    CompilerEndIf
    
    ; StatusBar
    CreateStatusBar(#MainStatusBar, WindowID(#Main))
    AddStatusBarField(#PB_Ignore)
    
    ; Gadgets
    dx = WindowWidth(#Main)
    dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar) - MenuHeight()
    EditorGadget(#MainEdit, 5, 5, dx -10, dy - 45)
    ButtonGadget(#MainButtonok, 10, dy - 35, 120, 30, "Ok")
    ButtonGadget(#MainButtonCancel, dx - 130, dy - 35, 120, 30, "Abbruch")
    
    ; Bind Events
    BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), #Main)
    
    ; Event Loop
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
          Select EventWindow()
            Case #Main
              Break
              
          EndSelect
          
        Case #PB_Event_Menu
          Select EventMenu()
            CompilerIf #PB_Compiler_OS = #PB_OS_MacOS   
              Case #PB_Menu_About
                PostEvent(#PB_Event_Menu, #Main, #MainMenuAbout)
                
              Case #PB_Menu_Preferences
                
              Case #PB_Menu_Quit
                PostEvent(#PB_Event_CloseWindow, #Main, #Null)
                
            CompilerEndIf
            
          Case #MainMenuAbout
            MessageRequester("About", #ProgramTitle + #LF$ + #ProgramVersion, #PB_MessageRequester_Info)
              
          Case #MainMenuExit
            PostEvent(#PB_Event_CloseWindow, #Main, #Null)
            
          EndSelect
          
        Case #PB_Event_Gadget
          Select EventGadget()
            Case #MainEdit
              Select EventType()
                Case #PB_EventType_Change
                  ;
                  
              EndSelect
              
            Case #MainButtonOk
              ;
            Case #MainButtonCancel
              ;
              
          EndSelect
          
      EndSelect
    ForEver
    
  EndIf
  
EndProcedure : Main()

Re: My First Post - Hello

Posted: Wed Dec 03, 2025 9:17 pm
by MikeGreen99
Thanks for the responses.

Writing the windows and gadgets by hand looks pretty formidable to me. I will delve into it shortly.

However, yesterday I was playing with the built in FormDesigner and got an error.

I will discuss this on another post entitled: "Not a function, Array, List, Map Or Macro"

Thanks,
M....