Page 1 of 1

Posted: Tue Aug 20, 2002 8:36 pm
by BackupUser
Restored from previous forum. Originally posted by cor.

Can I create gadgets Realtime? (on the fly).

e.g. from reading an ini file.

Or must I predefine a couple of gadgets and then hide/show, activate etc.

Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Tue Aug 20, 2002 9:53 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> Can I create gadgets Realtime? (on the fly).
> e.g. from reading an ini file.

Sure... creating 10 gadgets at startup is just the same as creating
5 at startup and another 5 later on in your code.


PB - Registered PureBasic Coder

Posted: Wed Aug 21, 2002 1:04 am
by BackupUser
Restored from previous forum. Originally posted by ricardo.

In Paul's site you can find some example using an ini file (ini2GUI is the name of the example).

Here is another example:

Code: Select all

If OpenWindow(0,100,10,250,500,#PB_Window_SystemMenu,"Create Gadgets at Runtime!")
  CreateGadgetList(WindowID())
  ButtonGadget(0,1,1,90,25,"Create Button")
  Repeat
    EventID=WaitWindowEvent()
    
    Select EventID
    
      Case #PB_EventGadget
        Select EventGadgetID()
          Case 0
            GadgetNum  = GadgetNum + 1
            ButtonGadget(GadgetNum,1 ,30*GadgetNum,80,25, "Button #" +Str(GadgetNum))
          Default
            MessageRequester("Click","Button#" + Str(EventGadgetID())+" was clicked",0)
        EndSelect
    
    EndSelect
    
  Until EventID=#PB_EventCloseWindow
EndIf