Using button on a form

Just starting out? Need help? Post your questions and find answers here.
User avatar
TI-994A
Addict
Addict
Posts: 2744
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Using button on a form

Post 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:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Post Reply