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

Username:   Password: 
 RegisterRegister   
 Nothing comes up after cls?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
yeyavailability




PostPosted: Tue May 27, 2008 7:39 pm   Post subject: Nothing comes up after cls?

I have some procedures which generates a checkmark when you click a box (a manual, picture way of making a checkbox). I can't use real checkboxes for teacherly reasons, but here is the code:

Turing:


var check_pic : int

%Checkmark for checkbox

procedure checkmark (x, y : int)
    check_pic := Pic.FileNew ("yes_check.bmp")
    Pic.Draw (check_pic, x, y, picMerge)
    Pic.Free (check_pic)
end checkmark

%Activates checkmark to go to selected page

procedure click (x1,x2,y1,y2,button,chk1,chk2 : int)
var mx, my, mb : int
loop
Mouse.Where (mx , my , mb)
if mx >= x1 and mx <= y1 and my >= x2 and my <= y2 and mb = button
then checkmark (chk1, chk2)
delay (200)
cls
end if
end loop
end click

% The thing:

click(7,7,24,24,1,1,1)



The problem is that after the checkmark appears for two seconds and the screen blanks out, it does not display the next slide. If I had something like

Turing:

put "blah"


it would not show up. The screen would just be blank, and if I close the window it would say on the workwindow that the program has been interrupted. I've been guessing that I've misplaced the cls command and maybe the delay command, so I've tried putting them everywhere that works (after one of the 'end' commands and after the 'click' command), but it either flashed to a white screen again or wouldn't clear at all.

Sorry if this is a facepalm question, I really don't know how to fix this ._.



Also, is there some way to make it so that I don't have to fulfill the first click before being able to click the next ones?
I have some things here:

Turing:


click(45,65,300,320,1,40,295) % Option 1
click(45,65,260,280,1,40,255)
click(45,65,220,240,1,40,255)
click(45,65,180,200,1,40,255)
click(45,65,140,160,1,40,255) % Option 5



If the first thing I wanted to click was option three, it wouldn't work because option 1 is first in line. I know there's something wrong with the way I coded the 'click' procedure that makes this happen. Is there any better way to do this?

Thankyou~



Attachment.rar
 Description:
Since so much code is missing and would look really weird if one tried to work it, here's the full (incomplete) thing.

Download
 Filename:  Attachment.rar
 Filesize:  1.83 KB
 Downloaded:  53 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
CodeMonkey2000




PostPosted: Tue May 27, 2008 7:42 pm   Post subject: RE:Nothing comes up after cls?

After you cls, you don't draw anything.
Danjen




PostPosted: Tue May 27, 2008 9:39 pm   Post subject: RE:Nothing comes up after cls?

Essentially, you would want to move your cls statement to the beginning of the loop. Thats should fix things. Smile
yeyavailability




PostPosted: Thu May 29, 2008 7:00 am   Post subject: Re: Nothing comes up after cls?

Thankyou to everyone who answered! I found out I just forgot the 'exit when' function ._.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: