
-----------------------------------
hosamhelal
Sat Jan 15, 2005 2:16 pm

Is there a way I can change the button's colour?
-----------------------------------
For GUI Buttons; they are always gray, but is there a way i can change the colours to like....mmm...blue or green or purple. or any other colour? I am using V 4.05 Turing :)  Please someone, thanks!

-----------------------------------
[Gandalf]
Sat Jan 15, 2005 3:17 pm


-----------------------------------
var exitbutton : int := GUI.CreateButton(940,20,0,"Exit",leave)

exitbutton is the variable for the button, 940 and 20 are the location of x and y.  The number right after y (20 in this case) is the colour of the button.  Exit is the label, and leave is the procedure that pressing the button will take you to.

I hope thats a good enough explanation, I'm fairly new to Turing.  If you need more help, type GUI.CreateButton and press "F9", that will take you to the help section for that command.

oh, and in case you don't know - the colours in turing are:


0 black        
1 blue           
2 green        
3 cyan        
4 red
5 magenta
6 brown
7 white
8 dark gray   
9 light blue
10 light green
11 light cyan
12 light red
13 light magenta
14 yellow
15 bright white


-----------------------------------
TheXploder
Sat Jan 15, 2005 3:38 pm


-----------------------------------
or, you could make your own buttons, I made a procedure that makes buttons like in VB and you can change the colour of them... its better to make your own buttons they don't take much to make, and its unlimited.

This draws the button:


% Selection Box ----------------------------------------------------
proc drawSelecLineY (x, y, buttonxsize, buttonysize : int)
    for i : 4 .. buttonysize - 4 by 2
        drawdot (x, y + i, 1)
    end for
end drawSelecLineY

proc drawSelecLineX (x, y, buttonxsize, buttonysize : int)
    for i : 4 .. buttonxsize - 4 by 2
        drawdot (x + i, y, 1)
    end for
end drawSelecLineX

proc drawSelectionBox (x, y, buttonxsize, buttonysize : int)
    drawSelecLineY (x + 4, y, buttonxsize, buttonysize)
    drawSelecLineY (x - 4 + buttonxsize, y, buttonxsize, buttonysize)
    drawSelecLineX (x, y + 4, buttonxsize, buttonysize)
    drawSelecLineX (x, y - 4 + buttonxsize, buttonxsize, buttonysize)
end drawSelectionBox
% -------------------------------------------------------------------

% Draw Released Button ----------------------------------------------------------------
proc objReButton (x, y, buttonxsize, buttonysize, clr : int)
    drawline (x, y, x + buttonxsize, y, 15)
    drawline (x + buttonxsize, y, x + buttonxsize, y + buttonysize, 15)
    drawline (x + 1, y + 1, x - 1 + buttonxsize, y + 1, 22)
    drawline (x + buttonxsize - 1, y + 1, x - 1 + buttonxsize, y + buttonysize - 1, 22)
    drawfillbox (x + 2, y + 2, x - 2 + buttonxsize, y - 2 + buttonysize, clr)
    drawline (x + 1, y + buttonysize - 1, x - 2 + buttonxsize, y + buttonysize - 1, 30)
    drawline (x + 1, y + buttonysize - 1, x - buttonxsize + 1 + buttonxsize, y + 2, 30)
    drawline (x, y + buttonysize, x - 1 + buttonxsize, y + buttonysize, 31)
    drawline (x, y + buttonysize, x - buttonxsize + buttonxsize, y + 1, 31)
end objReButton
% -------------------------------------------------------------------------------------

% Draw Pressed Button ------------------------------------------------------
proc objPrButton (x, y, buttonxsize, buttonysize, clr : int)
    drawfillbox (x + 2, y + 2, x - 2 + buttonxsize, y - 2 + buttonysize, clr)
    drawbox (x, y, x + buttonxsize, y + buttonysize, 7)
    drawbox (x + 1, y + 1, x - 1 + buttonxsize, y - 1 + buttonysize, 22)
end objPrButton
% --------------------------------------------------------------------------

% Draw Button(x, y, width, height, colour : int, [released/pressed], [selected/deselected] : srting)
proc drawbutton (x, y, buttonxsize, buttonysize, clr : int, press, select : string)
    if press = "released" and select = "selected" then
        objReButton (x, y, buttonxsize, buttonysize, clr)
        drawSelectionBox (x, y, buttonxsize, buttonysize)
    elsif press = "released" and select = "deselected" then
        objReButton (x, y, buttonxsize, buttonysize, clr)
    elsif press = "pressed" and select = "selected" then
        objPrButton (x, y, buttonxsize, buttonysize, clr)
        drawSelectionBox (x, y, buttonxsize, buttonysize)
    elsif press = "pressed" and select = "deselected" then
        objPrButton (x, y, buttonxsize, buttonysize, clr)
    end if
end drawbutton

% All Possibilities -------------------------------------------
drawbutton (1, 1, 50, 50, brightblue, "released", "deselected")
drawbutton (1, 51, 50, 50, brightblue, "pressed", "deselected")
drawbutton (1, 102, 50, 50, brightblue, "released", "selected")
drawbutton (1, 153, 50, 50, brightblue, "pressed", "selected")
%--------------------------------------------------------------


-----------------------------------
MysticVegeta
Sat Jan 15, 2005 7:00 pm

Re: Is there a way I can change the button's colour?
-----------------------------------
For GUI Buttons; they are always gray, but is there a way i can change the colours to like....mmm...blue or green or purple. or any other colour? I am using V 4.05 Turing :)  Please someone, thanks!
or maybe after declaring a button, you can go like this ->

var main :int:== GUI.CreateButtonFull (200, 200, 0, "START!", mainMenu, 0, KEY_ENTER, false)
GUI.Setcolor(main, brightred)


-----------------------------------
hosamhelal
Sat Jan 15, 2005 10:34 pm

Doenst work!
-----------------------------------
It says procedure set colour is not in the export list of 'GUI'

-----------------------------------
Cervantes
Sat Jan 15, 2005 11:26 pm


-----------------------------------
It's

GUI.SetColour

not

GUI.Setcolour


-----------------------------------
hosamhelal
Sun Jan 16, 2005 12:00 am


-----------------------------------
Thanks
