In a few weeks, depends on a better build-in PureBasic 'Events' implementation (hopefully coming with 3v1)
and some other stuff (like easiely creating PB libs with PB - still waiting for since 2v4...)
I will release the first public version of PureGUI.
Then you can use your Gadgets like:
Gadget1=PG_CreateButtonGadget(Window1,320, 10, 100, 25,"Button","Gadget 1 ToolTip",?FunctionGadget1)
The name of the Gadgets can change...
If you want, you (every registred user of PureBasic and Fred ) can make suggestions how to name the gadgets.
But remember, I don't want to interfere with the 'normal' PureBasic Gadgets names.
My First thought was to use the same 'gadget names' with an additional 'PG_' in front.
But as you can see I like also a 'CreateButtonGadget' syntax.
Now would be the time to tell me what you think...
'?FunctionGadget1' is the function called by pressed Left-Mouse-Button on the gadget...
Gadget Numbers are not needed anymore.
You don't have to create a event loop and catch the event for every gadget - all is automatically set.
If you need to use API calls and you need a gadget handle you can use the command:
GadgetHWND = GetGadgetID(Gadget1)
because the value returned (Gadget1) is the GadgetNumber. (Remember: a PureBasic Gadget returns the Handle/ID)
AFAIK Handles are Windows specific and not used in Linux or Amiga.
If you use StringGadgets - simply press 'Enter' after typing your string in, and the function behind this gadget
is called (in this way you can change a value of a variable or something like that) without pressing any other Gadgets.
ComboBox works the way it should (I hope... - for now win API used)
And more...
It would be nice to hear how many users are interested in something like that (Hi Fangles, I know you are...)
PureGUI code looks like:
Code: Select all
;start the PureGUI code
PureGUIApplication()
MainWindow1=PG_OpenWindow(200, 200, 320,240,#PB_Window_SystemMenu|#PB_Window_SizeGadget,"PureGUI Window")
Menu1=PG_CreateMenu()
PG_AddMenuTitle("Project")
MenuItem1=PG_AddMenuItem("New",?FunctionMenu1)
MenuItem2=PG_AddMenuItem("Open",?FunctionMenu2)
MenuItem3=PG_AddMenuItem("Save",?FunctionMenu3)
PG_AttachMenu(MainWindow1,Menu1)
ToolBar1=PG_CreateToolBar()
ToolBarButton1=PG_AddToolBarStandardButton(#PB_ToolBarIcon_New,"ToolBarButton 1 ToolTip",?FunctionButton1)
ToolBarButton2=PG_AddToolBarStandardButton(#PB_ToolBarIcon_Open,"ToolBarButton 2 ToolTip",?FunctionButton2)
ToolBarButton3=PG_AddToolBarStandardButton(#PB_ToolBarIcon_Save,"ToolBarButton 3 ToolTip",?FunctionButton3)
ToolBarButton4=PG_AddToolBarStandardButton(#PB_ToolBarIcon_Print,"ToolBarButton 4 ToolTip",?FunctionButton4)
ToolBarButton5=PG_AddToolBarStandardButton(#PB_ToolBarIcon_Find,"ToolBarButton 5 ToolTip",?FunctionButton5)
PG_AttachToolBar(MainWindow1,ToolBar1)
Gadget1=PG_CreateButtonGadget(MainWindow1,20, 100, 100, 25,"Button","Button 1 ToolTip",?FunctionGadget1)
PG_RunApplication()
End
IncludeFile "Functions.pbi"
;end the PureGUI code
In the IncludeFile Functions.pbi are all functions needed (as Subroutines).
It looks like:
Code: Select all
;start Functions.pbi
FunctionButton1:
XIncludeFile "FunctionButton1.pbi"
Return
FunctionButton2:
XIncludeFile "FunctionButton2.pbi"
Return
FunctionButton3:
XIncludeFile "FunctionButton3.pbi"
Return
FunctionButton4:
XIncludeFile "FunctionButton4.pbi"
Return
FunctionButton5:
XIncludeFile "FunctionButton5.pbi"
Return
FunctionGadget1:
XIncludeFile "FunctionGadget1.pbi"
Return
FunctionMenu1:
XIncludeFile "FunctionMenu1.pbi"
Return
FunctionMenu2:
XIncludeFile "FunctionMenu2.pbi"
Return
FunctionMenu3:
XIncludeFile "FunctionMenu3.pbi"
Return
; this is the very end my friend...
That's because I like to have my code reusable and the possibility to make a neat 'Visual IDE' called 'PureGUIDE'.
In PureGUIDE you draw a Gadget and when you press the right mouse button on it you get the possibility to enter
your code that will be executed.
Yes, it is a modular way to code and some of you don't like the IncludeFile stuff.
But it is the easiest way to write/delete/change gadget-function-code without messing up the main-code.
If there is no interest for such a GUI-Class in PureBasic let me know. (or if you think it is useless...)
Anyway tell me what you think...
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.