Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 GUI Pop up windows
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Pwah




PostPosted: Fri Nov 21, 2008 10:58 am   Post subject: 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
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Fri Nov 21, 2008 3:16 pm   Post subject: 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




PostPosted: Fri Nov 21, 2008 4:04 pm   Post subject: Re: GUI Pop up windows

I have been messing around with GUI.HideWindow and i added my own little throw together calculator to it


code:

% 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?

Neutral
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: