
-----------------------------------
Pwah
Fri Nov 21, 2008 10:58 am

GUI Pop up windows
-----------------------------------
aparently there is a way when you click on a gui button it opens the procedure in its own window.
if so how do you do it?
I want to be able to open it and when you clise it or click a button it runs a main screen again

-----------------------------------
TheGuardian001
Fri Nov 21, 2008 3:16 pm

Re: GUI Pop up windows
-----------------------------------
just have the first line in the procedure be a Window.Open call. The procedure will open a new window whenever called and run itself in that window.

-----------------------------------
Pwah
Fri Nov 21, 2008 4:04 pm

Re: GUI Pop up windows
-----------------------------------
I have been messing around with  GUI.HideWindow and i added my own little throw together calculator to it



% The "GUI.ShowWindow" program.
import GUI

var windowA, windowB : int
var buttonA, buttonB, buttonQuit, backToMainA, backToMainB : int
var cal1, cal2, answer : int
var i : string

procedure calculator 
put "Input First Number:"
    get cal1
    put skip
    put "Input Second Number:"
    get cal2
    put skip
    put "Input Method: (+, -, x)"
    get i
    if i = "+" then
        answer := cal1 + cal2

    elsif i = "-" then
        answer := cal1 - cal2

    elsif i = "x" then
        answer := cal1 * cal2
    end if
    put skip
    put "Answer:"
    put answer
    put skip
end calculator

procedure WindowA
    GUI.HideWindow (defWinID)
    GUI.ShowWindow (windowA)
end WindowA

procedure WindowB
    GUI.HideWindow (defWinID)
    GUI.ShowWindow (windowB)
end WindowB

procedure BackToMain
    GUI.HideWindow (Window.GetActive)
    GUI.ShowWindow (defWinID)
end BackToMain

View.Set ("graphics:280;100,nobuttonbar")
% Place the buttons in the main window
buttonA := GUI.CreateButton (10, 10, 0, "Show Window A", WindowA)
buttonB := GUI.CreateButton (150, 10, 0, "Show Window B", WindowB)
buttonQuit := GUI.CreateButton (100, 60, 0, "Quit", GUI.Quit)

windowA := Window.Open ("title:Window A,graphics:500;500")
calculator



backToMainA := GUI.CreateButton (20, 20, 0, "Back to Main", BackToMain)
Window.Hide (windowA)
windowB := Window.Open ("title:Window B,graphics:150;100,position:bottom;right")


backToMainB := GUI.CreateButton (20, 20, 0, "Back to Main", BackToMain)
Window.Hide (windowB)

loop
    exit when GUI.ProcessEvent
end loop


and it opens the window first (only when needing input tho)
what am I doing wrong or am i using the wring thing?

 :|
