Page 1 of 1

PB 5.11 - Visual Designer - SetGadgetState

Posted: Mon Mar 25, 2013 5:47 pm
by SniffTheGlove
Documentation for the Visual Designer is quite spares so I do not know if this is a bug or not but shall list it here.

Create a New Form then switch to code view. Paste the following code replacing what is currently in the code window.

Take a note of the code line SetGadgetState(Combo_0,1) in the OpenWindow_0() Procedure

Now goto the Form Menu and switch back Form view and then switch back to code view and you will notice that the SetGadgetState code line is no longer in the code. ie switching views deletes the code line.

Code: Select all

Global Window_0

Global Combo_0


Procedure OpenWindow_0()
  Window_0 = OpenWindow(#PB_Any, 0, 0, 310, 120, "", #PB_Window_SystemMenu)
  Combo_0 = ComboBoxGadget(#PB_Any, 40, 14, 100, 25, #PB_ComboBox_UpperCase)
  AddGadgetItem(Combo_0, -1, "N")
  AddGadgetItem(Combo_0, -1, "S")
  SetGadgetState(Combo_0,1)
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


Can anybody else confirm..

Re: PB 5.11 - Visual Designer - SetGadgetState

Posted: Mon Mar 25, 2013 7:05 pm
by Polo
Code not supported by the Form Designer is removed.
You should not assume any code apart from what the Designer actually generates will remain.

Re: PB 5.11 - Visual Designer - SetGadgetState

Posted: Mon Mar 25, 2013 8:19 pm
by SniffTheGlove
Polo wrote:Code not supported by the Form Designer is removed.
You should not assume any code apart from what the Designer actually generates will remain.
Thank you Polo for your reply.