Gadget ID's getting deleted.

You need some new stunning features ? Tell us here.
SniffTheGlove
Enthusiast
Enthusiast
Posts: 122
Joined: Sat Nov 19, 2011 6:51 pm

Gadget ID's getting deleted.

Post by SniffTheGlove »

In the IDE create a new form say 600 x 400

Switch to code view
Then paste this code into the Open window Procedure code just under the OpenWindow statement..

Code: Select all

  ContainerGadget (5, 15, 15, 295,107,#PB_Container_Double)
      ScrollAreaGadget(0, 0, 0, 290,120, 375, 155, 30,#PB_ScrollArea_BorderLess)
        ButtonGadget  (1, 10, 10, 230, 30,"Button 1")
        ButtonGadget  (2, 50, 50, 230, 30,"Button 2")
        ButtonGadget  (3, 90, 90, 230, 30,"Button 3")
        TextGadget    (4,130,130, 230, 20,"This is the content of a ScrollAreaGadget!",#PB_Text_Right)
      CloseGadgetList()
    CloseGadgetList()
Notice the Gadget ID's are 0,1,2,3,4,5

OK, now switch to Design View and then back to Code View, now all the Gadget ID's have been replaced with a single # and there will not compile


Or here is another route. Create a new Form, switch to code view then overwrite everything with the following code and then switch back to Design View and then back to Code View and all the ID's have been replaced with #

Code: Select all

Global Window_0


Procedure OpenWindow_0()
  Window_0 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu)
  ContainerGadget (5, 15, 15, 295,107,#PB_Container_Double)
      ScrollAreaGadget(0, 0, 0, 290,120, 375, 155, 30,#PB_ScrollArea_BorderLess)
        ButtonGadget  (1, 10, 10, 230, 30,"Button 1")
        ButtonGadget  (2, 50, 50, 230, 30,"Button 2")
        ButtonGadget  (3, 90, 90, 230, 30,"Button 3")
        TextGadget    (4,130,130, 230, 20,"This is the content of a ScrollAreaGadget!",#PB_Text_Right)
      CloseGadgetList()
    CloseGadgetList()
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Gadget ID's getting deleted.

Post by Polo »

Gadget ID must be constants and not numbers in the form designer.
SniffTheGlove
Enthusiast
Enthusiast
Posts: 122
Joined: Sat Nov 19, 2011 6:51 pm

Re: Gadget ID's getting deleted.

Post by SniffTheGlove »

Polo wrote:Gadget ID must be constants and not numbers in the form designer.
Thank you Polo
Post Reply