Computer Science Canada

In which cases would you use this button code?

Author:  Paul [ Thu Jan 29, 2004 10:52 pm ]
Post subject:  In which cases would you use this button code?

In which cases would you use:
code:

GUI.CreateButton (x, y, width : int, text : string,
    actionProc : procedure x ()) : int


and when would you useK
code:

GUI.CreateButtonFull (x, y, width : int, text : string,
    actionProc : procedure x (), height : int, shortcut : char, default : boolean) : int

Author:  shorthair [ Thu Jan 29, 2004 10:56 pm ]
Post subject: 

There is no need for create button full really , and i warn you as being a new programmer to istead of going into the path of GUI , go into the path of making your own buttons ,that way ther eis not reset prglems or mixups , and it will be alot fater aswell , if you would like to learn more about making your own buttons PM me

Author:  Paul [ Thu Jan 29, 2004 10:58 pm ]
Post subject: 

You mean like using mousewhere and stuff, check the x and y coordinates?
the problem is, I dont know how to make the program stop and wait for a click

like this:
code:

var font := Font.New ("serif:24")
var x, y, button : int
       
            Mouse.Where (x, y, button)
           drawbox (6, maxy -111, 111, maxy-74, black)
            drawfillbox (7, maxy -110, 110, maxy-75, grey)
           Draw.Text ("sure bet", 10, maxy - 100, font, 34)
           
           if button = 0 and x>6 and x < 111 and y > maxy-111 and y< maxy-74then
                locate (maxrow -5, maxcol -5)
                put "Sure Bet"
            else
                put " not clicked"
       
end if

how can I make it so that only a click is responded to?

Author:  jonos [ Thu Jan 29, 2004 11:36 pm ]
Post subject: 

i think you need to change button = 0 to button = 1 because button = 0 is no click on the mouse. also you should put it in a loop i think , that's what i do...

Author:  Delta [ Thu Jan 29, 2004 11:36 pm ]
Post subject: 

Well thats the thing... GUI.CreateButtonFull... at least the only reason I use it... is because you can set a shortcut key for it... say you want to press ctrl+z to undo something... then boom... it runs the button procedure... very useful

Author:  Paul [ Thu Jan 29, 2004 11:38 pm ]
Post subject: 

Thanx Jonos, even though I didn't get it right away, I got it eventually, I'll run a loop ONLY for the assignment of the variables, stupid me. Yay, self learning, I feel proud

Author:  we64 [ Thu Jan 29, 2004 11:44 pm ]
Post subject: 

maybe you could do something like what I did in my hangman program...
if you do, change my button a little better.... Laughing Laughing (my buttons were crappy. Very Happy )

Author:  Paul [ Thu Jan 29, 2004 11:45 pm ]
Post subject: 

you should see Ivan's, he showed me how to do the unpushed/pushed buttons.

Author:  jonos [ Fri Jan 30, 2004 12:09 am ]
Post subject: 

seriously, if you have any problems with turing, just go to turing reference and search for that command you have problems with, that's what i did for some stuff and it really helped (that's how i figured out the button = 1 thing a little white back)


: