
-----------------------------------
turinggirl
Sun May 13, 2012 11:44 am

GUI Help
-----------------------------------
What is it you are trying to achieve?



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



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)








Please specify what version of Turing you are using


-----------------------------------
Insectoid
Sun May 13, 2012 12:53 pm

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
[/code]

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).

-----------------------------------
evildaddy911
Sun May 13, 2012 2:16 pm

RE:GUI Help
-----------------------------------
the default window's constant is defWinID which = -1
