Page 1 of 1

Gadget ID's getting deleted.

Posted: Mon Apr 01, 2013 5:51 pm
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

Re: Gadget ID's getting deleted.

Posted: Tue Apr 02, 2013 9:26 pm
by Polo
Gadget ID must be constants and not numbers in the form designer.

Re: Gadget ID's getting deleted.

Posted: Tue Apr 02, 2013 10:08 pm
by SniffTheGlove
Polo wrote:Gadget ID must be constants and not numbers in the form designer.
Thank you Polo