Computer Science Canada how to UNDO? |
Author: | Wing_Wing [ Sat Nov 25, 2006 11:35 pm ] |
Post subject: | how to UNDO? |
I have this code thing here... View.Set ("offscreenonly") var mx, my, mx2, my2, mb, pic : int loop mousewhere (mx, my, mb) if mb = 1 then pic := Pic.New (0, 0, maxx, maxy) loop mousewhere (mx2, my2, mb) Pic.Draw (pic, 0, 0, picCopy) drawbox (mx, my, mx2, my2, black) exit when mb not= 1 View.Update end loop end if end loop and it can draw boxes, but how do i make it so that i can also undo? anyone help me out? |
Author: | CodeMonkey2000 [ Sun Nov 26, 2006 12:15 am ] | ||
Post subject: | |||
not sure wat u mean by "undo" but if u want 2 get rid of the boxes cls it and u need to free the pic
|
Author: | Wing_Wing [ Sun Nov 26, 2006 7:56 pm ] |
Post subject: | |
i mean by pressing keys such as CTRL+Z to undo |
Author: | Tony [ Mon Nov 27, 2006 10:47 am ] |
Post subject: | |
you would have to take a screenshot and save it, before drawing a new box. Input.KeyDown to read input, and if it's Ctrl+Z, draw saved image to screen to 'step back'. Though I think that Ctrl+Z might have a special meaning in Turing.. ![]() |
Author: | Prince Pwn [ Mon Nov 27, 2006 2:12 pm ] | ||
Post subject: | |||
Yeah for some reason none of the CTRL_ combos work... Probably because Windows uses them. eg:
|
Author: | Prince Pwn [ Mon Nov 27, 2006 2:15 pm ] |
Post subject: | |
Wait I just found this in the Turing help menu... Quote: Constants beginning with "KEY_" are char values. These are the values returned by getch and used as an index into the Input.KeyDown array. The constants that the constants KEY_KEYPAD_5, KEY_SHIFT, KEY_CTRL and KEY_ALT can only be used in conjunction with Input.KeyDown. The getch and getchar subprograms do not return these values. All other constants with with SHIFT, CTRL and ALT as part of the name cannot be checked for in the Input.KeyDown array. |
Author: | Tony [ Mon Nov 27, 2006 2:39 pm ] | ||
Post subject: | |||
right, so what you are looking for is
|
Author: | Prince Pwn [ Mon Nov 27, 2006 5:37 pm ] |
Post subject: | |
Cool that way works =D But not in text mode =( |
Author: | Clayton [ Mon Nov 27, 2006 5:52 pm ] |
Post subject: | |
won't Ctrl + Z noramally crash Turing during a get though ![]() |
Author: | ericfourfour [ Tue Nov 28, 2006 12:45 am ] |
Post subject: | |
Freakman wrote: won't Ctrl + Z noramally crash Turing during a get though
![]() Yes it will. I don't remember anyone brining up get though. But I guess that is partly why Tony went over using Input.KeyDown. ![]() |
Author: | Foundation [ Sun Dec 03, 2006 5:40 pm ] |
Post subject: | |
In the help menu there is a portion on what Input KeyDown can take. Look that up, but I'm not sure what you mean when you want it to work in text mode because I'd guess you are doing a paint program for school and work in graphics mode. |