Howto execute a program
-
- New User
- Posts: 9
- Joined: Fri Oct 17, 2025 10:10 pm
Howto execute a program
I have created a pbf file using Form Designer and it runs fine. However,
when I create a *.pb file ie:-
Procedure BrowserButtonsClick(EventType)
Debug "Here"
EndProcedure
IncludeFile "/home/roger/_dev1/source/purebasic-v612/@editorONE/editorONE.pbf"
i receive the messages:-
Executable started
The program execution has finsihed
and yet I never see the form..
Gotta be the simplest thing, how do I put my 1st program together. I am assuming that the *.pb file has my event handlers and I include the *.pbf within that ?
EDIT:-
when I code this :-
IncludeFile "/home/roger/_dev1/source/purebasic-v612/@editorONE/editorONE.pbf"
OpenWindow_0(100,100,1440,900)
Procedure BrowserButtonsClick(EventType)
Debug "Here"
EndProcedure
the program falls over with :- gtk_accel_group_connect:assertion 'accel_key > 0' failed
on the following line in the .pbf
AddKeyboardShortcut(Window_0, #PB_Shortcut_Control | #PB_Shortcut_Shift, #M_SaveAs)
although the .pbf will still run correctly when ran in isolation
Roger
when I create a *.pb file ie:-
Procedure BrowserButtonsClick(EventType)
Debug "Here"
EndProcedure
IncludeFile "/home/roger/_dev1/source/purebasic-v612/@editorONE/editorONE.pbf"
i receive the messages:-
Executable started
The program execution has finsihed
and yet I never see the form..
Gotta be the simplest thing, how do I put my 1st program together. I am assuming that the *.pb file has my event handlers and I include the *.pbf within that ?
EDIT:-
when I code this :-
IncludeFile "/home/roger/_dev1/source/purebasic-v612/@editorONE/editorONE.pbf"
OpenWindow_0(100,100,1440,900)
Procedure BrowserButtonsClick(EventType)
Debug "Here"
EndProcedure
the program falls over with :- gtk_accel_group_connect:assertion 'accel_key > 0' failed
on the following line in the .pbf
AddKeyboardShortcut(Window_0, #PB_Shortcut_Control | #PB_Shortcut_Shift, #M_SaveAs)
although the .pbf will still run correctly when ran in isolation
Roger
Re: Howto execute a program
The easiest way to get started is via the examples under Purebasic\Examples
or press F1 with the mouse over any command in the code.
you have a couple of choices you can bindevents to procedures or process them in the waitwindowEvent loop
or press F1 with the mouse over any command in the code.
you have a couple of choices you can bindevents to procedures or process them in the waitwindowEvent loop
Code: Select all
Procedure Button1_Event()
Debug "event type" + EventType()
Select EventType()
Case #PB_EventType_LeftClick
Debug "Button 1 event callback"
EndSelect
EndProcedure
If OpenWindow(0, 0, 0, 230, 90, "Event handling example...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget (1, 10, 10, 200, 20, "Click me")
CheckBoxGadget(2, 10, 40, 200, 20, "Check me")
BindGadgetEvent(1,@Button1_Event()) ;you can bind gagget events to a procedure
If CreateMenu(0, WindowID(0))
MenuTitle("Menu")
MenuItem(1, "Item 1")
MenuItem(2, "Item 2")
MenuItem(3, "Item 3")
EndIf
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 2 : Debug "Button 2 clicked!"
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case 1 : Debug "Menu item 1 clicked!"
Case 2 : Debug "Menu item 2 clicked!"
Case 3 : Debug "Menu item 3 clicked!"
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
-
- New User
- Posts: 9
- Joined: Fri Oct 17, 2025 10:10 pm
Re: Howto execute a program
That's all in the same source file though and doesn't really address the problem I am having
Re: Howto execute a program
You must enter at least one normal control character.
Only Ctrl+Shift does not work ...
Only Ctrl+Shift does not work ...
Code: Select all
AddKeyboardShortcut(Window_0, #PB_Shortcut_Control | #PB_Shortcut_Shift | #PB_Shortcut_S, #M_SaveAs)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Howto execute a program
A nice examples by TI-994A
viewtopic.php?t=61715
viewtopic.php?t=64684
PureBasic Form Designer Tutorial.https://youtu.be/MZyi7GjS7gM
viewtopic.php?t=61715
viewtopic.php?t=64684
PureBasic Form Designer Tutorial.https://youtu.be/MZyi7GjS7gM
-
- New User
- Posts: 9
- Joined: Fri Oct 17, 2025 10:10 pm
Re: Howto execute a program
I entered "Ctrl+Shift+S" and the form designer created the code
Should it be entered differently.
Also why would the .pbf code work standalone ?
Should it be entered differently.
Also why would the .pbf code work standalone ?
Re: Howto execute a program
Ok,
Is a bug in FormDesigner. Evaluates only two specifications. When I have time, I'll take a closer look at the PB-IDE code.
Insert the shortcut yourself behind OpenWindow_0() until it has been fixed.
Is a bug in FormDesigner. Evaluates only two specifications. When I have time, I'll take a closer look at the PB-IDE code.
Insert the shortcut yourself behind OpenWindow_0() until it has been fixed.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
-
- New User
- Posts: 9
- Joined: Fri Oct 17, 2025 10:10 pm
Re: Howto execute a program
It seemed whenever I moded the created code the change disappeared.
Re: Howto execute a program
That's right.
The code is always recreated.
Therefore, remove the shortcut in FormDesigner and add it to your own code.
The code is always recreated.
Therefore, remove the shortcut in FormDesigner and add it to your own code.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Howto execute a program
When you compile and run a form design on its own, the form designer constructs a minimal event loop and adds this to the file content before passing it to the compiler. It does this invisibly.
Your program is terminating without doing anything because it doesn't contain an event loop, or it's halting prematurely.
Yes, the form designer isn't a full source code parser, unlike the rest of the IDE. It expects to work from its own dialogs and maintains its own data structures. When you save/view a file the source shown is built from the data structures not the source code in the editor. As a consequence of this additions may disappear, if the Form Designer can't parse them properly. (There are historical reasons for this. When it was first released it was a separate application not an integrated tool in the IDE.)RogerTunnicliffe wrote: Sat Oct 18, 2025 12:30 pm It seemed whenever I moded the created code the change disappeared.