Page 2 of 2

Re: Using button on a form

Posted: Tue Feb 24, 2015 1:23 pm
by TI-994A
ptaylor2014 wrote:Will someone please give the correct answer to my question included above?
Hello ptaylor2014. Please read the full answer, posted above (or click this link).

In short, to handle two forms, one named MyForm.pbf which contains two buttons, one button to open the second form, Accounts.pbf, and another button to end the program, the code should look something like this:

Code: Select all

IncludeFile  "MyForm.pbf"
IncludeFile  "Accounts.pbf"

Procedure Button_0_Procedure(EventType)
  OpenAccounts()
EndProcedure

Procedure Button_1_Procedure(EventType)
  End
EndProcedure

OpenWindow_0()

Repeat
  event = WaitWindowEvent()
  Select EventWindow()
    Case Window_0
      If Window_0_Events(event) = #False
        End
      EndIf
    Case Accounts
      If Accounts_Events(event) = #False
        CloseWindow(Accounts)
      EndIf
  EndSelect
ForEver
This handles the two buttons on MyForm.pbf, and it assumes that Accounts.pbf has a window with the variable name Accounts, and no gadget events to process. As mentioned earlier, a more detailed example has been posted above (link here).

Hope you find it! :lol: