GUI Help
Author |
Message |
turinggirl
|
Posted: Sun May 13, 2012 11:44 am Post subject: GUI Help |
|
|
What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>
What is the problem you are having?
How can I carry out the sum on one window to another window using GUI?
Here is part of my program:
procedure windowBCheckout
GUI.HideWindow (defWinID)
GUI.ShowWindow (WindowBCheckout)
end windowBCheckout
count:int:=0
procedure windowtouch
count := count + 199
put count
end windowtouch
buttontouch := GUI.CreateButton (765, 350, 0, "Add to Cart", windowtouch)
in another window:
windowtouch %but this gives me 0 instead of 199
Let say I have a bunch of calculations on one window, how would I carry out the sum to another window?
It's really difficult to explain on this website S:
Describe what you have tried to solve this problem
<Answer Here>
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing: |
<Add your code here>
|
Please specify what version of Turing you are using
<Answer Here> |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Sun May 13, 2012 12:53 pm Post subject: RE:GUI Help |
|
|
You switch between windows using their IDs.
Each window (except the default) should be bound to a variable (window1, window2, whatever). The default window has a static ID (though I forget what it is).
There's a Window.setActive() command (or something like that) where you pass the window you want to use as the active window. All screen output will go to this screen. Then you can switch back as necessary.
code: |
%Pseudocode
win1 = Window.Open ("Graphics")
win2 = Window.Open ("Graphics")
Window.setActive (win1)
%do calculations
Window.setActive (win2)
put sum
|
The default window (the one that pops up automatically when you draw/put something) has a specific ID (probably 1) that you can pass to the setActive function (so you would call Window.setActive(1) to activate the default window). |
|
|
|
|
![](images/spacer.gif) |
evildaddy911
|
Posted: Sun May 13, 2012 2:16 pm Post subject: RE:GUI Help |
|
|
the default window's constant is defWinID which = -1 |
|
|
|
|
![](images/spacer.gif) |
|
|