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

Username:   Password: 
 RegisterRegister   
 GUI textbox output - removal of other text
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chrispaks




PostPosted: Fri May 06, 2005 7:08 pm   Post subject: GUI textbox output - removal of other text

This is the code

Quote:
%SinCosTan #2
import GUI
View.Set ("graphics:360;400,nobuttonbar")
colorback (grey)
cls
GUI.SetBackgroundColour (grey)
var number : real := 0
procedure sine
locate (3, 4)
put sind (number)
end sine
procedure cosine
locate (3, 19)
put cosd (number)
end cosine
procedure tangent
locate (3, 34)
put tand (number)
end tangent
procedure arcsine
locate (10, 4)
put arcsind (number)
end arcsine
procedure arccosine
locate (10, 19)
put arccosd (number)
end arccosine
procedure arctangent
locate (10, 34)
put arctand (number)
end arctangent
procedure Quit
GUI.Quit
end Quit
var c1 := GUI.CreateButton (10, 370, 100, "Sine", sine)
var c2 := GUI.CreateButton (130, 370, 100, "Cosine", cosine)
var c3 := GUI.CreateButton (250, 370, 100, "Tangent", tangent)
var c4 := GUI.CreateButton (10, 260, 100, "ArcSine", arcsine)
var c5 := GUI.CreateButton (130, 260, 100, "ArcCosine", arccosine)
var c6 := GUI.CreateButton (250, 260, 100, "ArcTangent", arctangent)
var c7 := GUI.CreateButton (80, 20, 200, "Quit SinCosTan Program", Quit)
GUI.Disable (c1)
GUI.Disable (c2)
GUI.Disable (c3)
GUI.Disable (c4)
GUI.Disable (c5)
GUI.Disable (c6)
GUI.Disable (c7)
locate (15, 1)
put "Enter a degree/number between 0-90): " ..
get number
cls
locate (15, 1)
put "Enter a degree/number between 0-1): ", number
var b1 := GUI.CreateButton (10, 370, 100, "Sine", sine)
var b2 := GUI.CreateButton (130, 370, 100, "Cosine", cosine)
var b3 := GUI.CreateButton (250, 370, 100, "Tangent", tangent)
var b4 := GUI.CreateButton (10, 260, 100, "ArcSine", arcsine)
var b5 := GUI.CreateButton (130, 260, 100, "ArcCosine", arccosine)
var b6 := GUI.CreateButton (250, 260, 100, "ArcTangent", arctangent)
var q1 := GUI.CreateButton (80, 20, 200, "Quit SinCosTan Program", Quit)
if number < 1
then
GUI.Disable (b1)
GUI.Disable (b2)
GUI.Disable (b3)
end if
if number > 1
then
GUI.Disable (b4)
GUI.Disable (b5)
GUI.Disable (b6)
end if
loop
exit when GUI.ProcessEvent
end loop



Im forever working with trigonometric functions so bare with me lol...

Now run that program, and whenever i click in order "sine, cosine, tangent" the numbers all appear under it, but if I click in another order or random buttons multiple times, the cosine or tangent sometimes disappears. How do I fix this (code aleration would help more since I could visually see it also), Thanks.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat May 07, 2005 1:22 pm   Post subject: (No subject)

When you output text with locate(x,y), the entire line gets whiped white. It's much more obvious if you set backgroundcolour(blue) for example. So when you put new text, everything to the right of it is drawn over.

You've got to use Font.Draw() instead.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: