VARKON Version 1.15 1997-10-24

> ## cre_button - Function

> Create button
> Description
> Creates a button in a dialogue window. Buttons without frames ( frame = 0 ) are regarded as simple text labels. A button without frame and with str1 = str2 = "" (null string) appear as simple rectangles and may be used for decoration.
> Buttons with frame may toggle between two states if str1 is different from str2 or may not toggle if str1 = str2.
> Clicking a button with frame generates an event that will be catched if waited for by the wait_win() routine.
> Syntax
> cre_button(window, pos, width, height, frame, str1, str2, font, bcolor, tcolor)

> INT | window;
> VECTOR | pos;
> FLOAT | width;
> FLOAT | height;
> FLOAT | frame;
> STRING | str1;
> STRING | str2;
> STRING | font;
> INT | bcolor;
> INT | tcolor;

> Principal parameters

> window | - Dialogue window identity
> pos | - Upper left coordinates relative to the dialogue window
> width | - Horisontal size in pixels
> height | - Vertical size in pixels
> frame | - Frame width in pixels
> str1 | - Default string
> str2 | - Toggle string

> Optional parameters

> font | - Textfont (UNIX, with Microsoft Windows font = Size, see below)
> bcolor | - Background color (UNIX only, not supported on Microsoft Windows)
> tcolor | - Text color (UNIX only, not supported on Microsoft Windows)

> Return value
> An INT holding the id of the button created.
> Example
> button_id:=cre_button(dia_win, 5, 5, 0, "","","",2);
> Creates a rectangle 5 by 5 pixels filled with colour number 2, usually red. No text is displayed.
> button_id:=cre_button(dia_win, 5, 5, 0, "Text","");
> Creates a text label.
> button_id:=cre_button(dia_win, 5, 5, 1, "OKEY", "OKEY");
> Creates a non toggling button.
> button_id:=cre_button(dia_win, 5, 5, 1, "ON", "OFF");
> Creates a toggle button.
> Comments
> The Microsoft Windows implementation of VARKON is different from the UNIX implementation when it comes to fonts for text. In UNIX where X-Windows (X11) is used fonts of different sizes have different names but in Microsoft Windows a font with a certain name may be displayed in many different sizes.
> The font parameter in cre_button() is treated as the name of a X11 font if UNIX is used but treated as the size of the currently active font set by VARKON.INI if Windows is used.
> Frame width can be zero or one but the UNIX version of VARKON also honours values greater than one to create thicker frames if needed.
> The Microsoft Windows implementation of VARKON currently does not support parameters bcolor and tcolor.

VARKON Homepage | Index