LGM EvuGUI v1.00
By Anben Panglose (C)opyright 2001.

    Introduction
    How to use EvuGUI?
    Reference manual
    Making an application for Evulgo
    Used variables and constants description
    Contact infos


Introduction

Welcome and thank you for your interest in EvuGUI. What is EvuGUI? Well, I am making a shell named Evulgo (a sort of graphical user interface which helps you organize programs and manipulating files...) . You have downloaded the GUI that Evulgo will use, (EvuGUI) now you can make your own GUI under Qbasic with simple statements... This documentation explain how to use the routines. If you find any bugs, please contact me and I'll try to make something. By the way, please excuse my english, I speak french :)
Although every effort has been made to insure the accuracy of the material in this guide, LGM Labs, Anben panglose assume no responsibility for errors or omissions. In addition no liability is assumed for damages resulting from the use of the information contained herein.


How to use EvuGUI?

First some infos on the Lib:
EvuGUI was made under QBX 7.1 (PDS), I don't think it will work under QB45, I will make a compatible version later...
EvuGUI was made using the Future library from http://qbasic.qb45.com , so you will need this library if you plan to modify the source code. To minimize the size of the Lib, I've used only 2 groups of the routines included in the Future lib: Svga > Mouse And Xms routines. Just load the EvuGUI.qlb to start making your program.

ex: Qbx /l Evugui.qlb

After loading the library in memory, open one the Sample.bas included to make your app.
And don't forget to call the InitGUI sub before doing anything.


Reference manual

Font routines: XmsLoadFont, Length, Evufont

String manipulating: CutString, ShowError, Trim, WordWrap, ECIS

Drawing routines:
    Icons:
CrtIcoBnk, LoadInIcoBnk, DrawFromIcoBnk, DrawIcon
    Misc: Shape, HLine3D, Frame, Btn, Form

Controls: CmdBtn, OptB, ChkB, TextB, Mtip

Misc routines: Testmouse, Loadcur, FileExist, InitGui, CurRes, TextBoxInUse


FUNCTION XmsLoadFont% (Fil$)

Usage: Load a font file in the Xms Memory, so that you can use it to print something on the screen.

Variable description:
Fil$ = Path and name of the Font file to load, the font file is in the Evulgo format .enf)

Syntax example:
Verdana% = XmsLoadfont("Fonts\Verdana.enf")

Value returned: the Xms handle of the loaded font, use this value with any routines which need the FontHandle parameter.

Don't forget to free up (DeallocateXms) the handle before exiting your program... For an example please see the Font.bas file included with this package.

See also: Evufont, Lenght


FUNCTION Length% (XmsFontHandle%, Text$, Style)

Usage: Determine the width of a string following the font used and its style (Bold or not)

Variable description:
XmsFontHandle% = Handle of the font in the Xms memory, please see XmsLoadFont for more infos.
Text$ = String to evaluate
Style = Style of the Text to evaluate (bold style takes more space)

Syntax example: HowLong = Length%(Verdana%, "This is a testing string, é hello! è", 0)

Value returned: The width in pixel of the string

Before using this routine, make sure to load a font in the Xms memory first!
Style = 1 : Bold, else the string is evaluated a normal.
For an example please see the Font.bas file included with this package.

See also: Evufont, XmsLoadfont


SUB Evufont (xd%, yd%, Text$, Style, BYVAL C&, Xmshand%)

Usage: Print a string on the screen

Variable description:
xd% = X position
yd% = Y position
Text$ = The string to print
Style = The style of the string to, Style = 1, then the string is printed in bold.

C& = The color of the string to print
Xmshand% = the xms handle of the font which will be used to print the string, see XmsLoadfont.

Syntax example: Evufont 100, 100, "This is a test, do you like Deathwish (Police)?", 1, 4, Verdana%
For an example please see the Font.bas file included with this package.

Before using this routine, make sure to load a font in the Xms memory first!

See also:
Length, XmsLoadfont


FUNCTION CutString$ (St$, MaxW%, Start%, Font%, Style%)

Usage: Cut A string according to a specified width (in pixels), font and style, a sort of Right$ or Left$ but no using the length of the string, but its width

Variable description:
St$ = The string to cut from
MaxW% = the width to not fit the string in
Start% = The Start position, if Start% = -1 then the funtion act like the Left$ function, if Start = 1 then it acts like the Right$ function
Font% = XmsHandle of the fontdata
Style% = Bold or not, see Evufont

Value returned: The new, shorter string.

Syntax example: Fitin$ = CutString$("I only want the first fifteen pixels!", 50, -1, Verdana%, 0)
in this example, try change the start to 1, then you will have the last 50 pixels of the string...
This routine is used by EvuGUI, nut it can be useful...

See also: Lenght, Evufont, XmsLoadfont, Wordwrap


SUB ShowError (Text$)

Usage: Exclusively used by EvuGUI to alert the user that a error as occurer, it just print a ugly text (destroying the background) notifying the user that for example that a font file is not found...


FUNCTION Trim$ (Text$)

Usage: Remove the leading a trailing spaces (a mix of Ltrim$ and Rtrim$)


FUNCTION WordWrap$ (Text$, LengthLimit%, Fonthandle%, Style)

Usage: Take a string and cut it into severals string respecting grammar rules, in other words, it's useful to make wordwrap!

Variable description:
Text$ = String to "fragment"
LengthLimit% = The width in pixel to fit a fragment in.
Fonthandle AND = Self explicit, see Xmsloadfont And Evufont

Syntax example: This function works in a loop, just like the Dir$ function:
a$ = "Hello word, this is a testing string, we have to make it a bit long so that you can see that it works, by the way, excuse my english, I speak french!"
DO
  Sentence$ =
WordWrap$(a$, 200, Verdana%, 0)
LOOP UNTIL Sentence$ = ""

Value returned: A Fragment of the whole string, when nothing is returned then all the string has been evaluated.
See Font.bas for an example.

See also: Xmsloadfont, Evufont, CutString


FUNCTION ExistCharacterInString% (Lookin$, Lookfor$)

Usage: Determine if a character(s) exist somewhere in a string

Variable description:
Lookin$ = String to look in
Lookfor$ = a character, or a list or characters to search for (Lookfor$ = "f", will serah for the f letter, Lookfor$ = "abcd" will serach first for the a letter, then for the b letter... if either one of the letter is found the the function return the True value...

Syntax example: IsthereYorJ = ECIS("Hello, how are you?") (value returned = True)


FUNCTION CrtIcoBnk% (Number%)

Usage: Prepare a place in the Xms Memory to strore some icons: create an icon bank

Variable description:
Number% = Number of Icons you want to load, more you want load, more memory you will need

Value returned: The handle of the IconBank in the Xms memory, use it with any routines which need the IcoHandle parameter.

Don't forget to delete the IcoBank before exiting your program with the DeallocateXms routine.
See the Icon.bas example for more informations.

See also: LoadInIcoBnk, DrawFromIcoBnk, DrawIcon


SUB LoadInIcoBnk (IcoBankHandle%, Fil$, Index%)

Usage: Load a icon file in a Icon Bank created with CrtIcoBnk

Variable description:
IcoBankHandle% = Handle of the Icon Bank in the xms memory (see CrtIcoBnk)
Fil$ = Path and name of the icon file to load in the bank
The file is in the evulgo icon format (.eic)
Index% = The index in the bank in which the icon will be load.
If Index% < 0 or Index% > Prepared room, you will get a "Out of Bound" error, (see CrtIcoBnk)

See the Icon.bas example for more informations.

See also: CrtIcoBnk, DrawFromIcoBnk, DrawIcon


SUB DrawFromIcoBnk (IcoBnkhandle%, Index%, X%, Y%)

Usage: Put on the screen a icon which was stored in a IconBank (Xms memory)

Variable description:
IcoBankHandle% = Handle of the Icon Bank in the xms memory (see CrtIcoBnk)
Index% = The index in the bank of the icon you want to draw.
If Index% < 0 or Index% > Prepared room, you will get a "Out of Bound" error, (see CrtIcoBnk)
X% = X position to draw
Y% = Y position to draw

This method is much more faster that DrawIcon because it uses the Ram memory, not the Hdd.
See the Icon.bas example for more informations.

See also: CrtIcoBnk, LoadInIcoBnk, DrawIcon


SUB DrawIcon (X%, Y%, Fil$)

Usage: Put on the screen a icon from a storage media such as the hdd. Much more slower that the DrawFromIcoBnk routine.

Variable description:
X% = X position to draw
Y% = Y position to draw
Fil$ = Path and name of the icon file to draw on the screen.
The file is in the evulgo icon format (.eic)

See also: CrtIcoBnk, LoadInIcoBnk, DrawFromIcoBnk


SUB Frame (X%, Y%, W%, H%, Caption$)

Usage: Draw a 3d Frame

Variable description:
Hotspot = Left Bottom
X% = X position
Y% = Y position
W% = width
H% = heigth
Caption$ = the text to write


SUB Shape (X%, Y%, C&, Style%)

Usage: Draw a custom shape on the screen, used by EvuGUI


SUB HLine3d (X%, Y%, W%, C1&, C2&)

Usage: draw a 3d horizontal line

Variable description:
X% = X pos
y% = Y Pos
w% = width
c1& = light color
c2& = dark color

you can use c1& = 8 and c2& = 15


SUB Btn (X, Y, W, H, Cpt$, CptColor&, CptFont, CptStyle, IcoHandle, IcoIndex, Layout, BtnStyle)

Usage: Draw a beveled rectangle with a text and icon in it (3d button)

Variable Description:
HotSpot = Left Bottom
X = X pos
Y = Y pos
W = width
H = Height
Cpt$ = Caption, text to write on the button
CptColor& = Color of the caption
CptFont = FontHandle to use to write the Caption (use XmsLoadfont)
CptStyle = Style of the caption (1 = Bold)
IcoHandle = Handle of the IconBank containing the icons to be draw (Use CrtIcoBnk and LoadInIcoBnk)
IcoIndex = Index of the icon to use from the Icon Bank
Layout = Layout of the content of the button:
0 = centered, 1 = Left, 2 = Right
BtnStyle = Style of the Buttons (Bevel style)

See Icon.bas for example. If X or Y = -1 then X or Y will be recalculated so as to center the button on the screen. If IcoHandle = 0 then no icon will be drawn. If Cpt$ = "^cHeCk^" (case sentitive) then a check will be drawn instead of the text with the CptColor& Color (this feature is used by EvuGUI)
Here are the different style available at this time:
Btnstyles.jpg (2948 bytes)


SUB Form (X, Y, W, H, CptFont, CptColor&, CptStyle, Caption$, Style)

Usage: Draw a window with the Evulgo Style.

Variable description:
HotSpot = LeftBottom
X = Xpos
y = Ypos
W = width
H = Height
Cpfont = Handle of the font (See XmsLoadfont)
CptColor& = Color of the title
Cptstyle = Style of the title

Caption$ = Title of the window
Style% = Style of the window
Here are the available style at this stage: (Style 1 and 2)
frm.gif (3031 bytes)


DECLARE FUNCTION LoadCur$ (File$)

Usage: Load a cursor file (in the evulgo format (.cur))

This function returns the string which you can pass to the future Lib tom change the mouse cursor...


DECLARE FUNCTION FileExist% (File$)

Usage: Test if a file exists or not


DECLARE FUNCTION TestMouse% ()

Usage: Test if a mouse is present or not


SUB InitGui (PrefFile$, Prefer as Preferences)

Usage: Must be called before any other EvuGUI routines, it setup the infos for the mouse, and the basic lors

PrefFile$ = The Preference file where is stored all the paremters needed. In this version of EvuGUI, this paremter can be omitted, just give a null string and all the default colors and settings will be set.
Prefer as Preferences = All the current GUI parameters (colors, mouse buttons...) are stored in that Variable, if you need any of these parameters, see the Preferences Strutures.


SUB CurRes (MaxX%, MaxY%)

Usage: Give the current Resolution, just get the Xmax and Ymax.
Ex: CurRes (X,Y): Future.Print 1,1,"Current Resolution:" + str$(X) + "x" + Str$(Y), 15, 0


FUNCTION TextBoxInUse ()

Usage: Inform the programmer if a textbox is in use, then return true. To use when in a loop there is a inkey$ call and a TextBox, because when the user is entering something in the textbox, the inkey$ function is used, so if you use it somewhere else et the same time, textbox will not catch all the keystroke, there must be one inkey$ call at once in a loop... See the TextBox.bas example.


FUNCTION TextB% (ID, X, Y, W, TextFont, TextColor&, TextStyle, Text$, Max, TipFont, TipColor&, TipStyle, Tip$, ShowedText$)

Usage: Replacement of the native input, it's a textbox

Variable description:
Id% = The Unique Id for this control (unique id for all the text box in the current loop)
Hotspot = LeftBottom
x% = X pos
y% = Y pos
W% = width
TextFont = Font handle for the text (See XmsloadFont)
TextColor& = Color of the text
TextStyle = Style of the text (1 = Bold)

Text$ = Variable that holds the text
Max% = the maximum characters that the user can enters
TipFont = Font handle for the tootip (See XmsLoadfont)
Tipcol& = color of the tip
TipStyle = Style of the tip (1 = Bold)

tip$ = tooltip that appear when the mouse is left over the textbox
ShowedText$ = variable that holds the text currently displayed

Syntax:
This control must be used in a loop
By giving a value to Text$ before calling the function and before Done = True, the textbox will have a default text in it: Text$
To see what I am talking about, see the TextBox.bas example.
For more Information about the Done varaible, please see Used variables and constants

Value returned: If the Textbox was validated ([Enter] pressed, or clicked away) then True is returned


FUNCTION OptB% (ID, X, Y, CptFont, CptColor&, CptStyle, Caption$, TipFont, TipColor&, TipStyle, Tip$, Array() AS OPTIONBOX)

Usage: If you have several options, but only one can be selected at once, then this control is for you. It's an option Box

Variable description:
Id% = Unique option Id within the same loop
x% = Xpos
y% = Ypos
CptColor& = Caption color
CptFont = Font Handle which contains the fontdata which will be used to print the caption

CptStyle = Style of the caption (1 = Bold)
TipFont = Font handle for the tootip (See XmsLoadfont)
Tipcol& = color of the tip
TipStyle = Style of the tip (1 = Bold)
Caption$ = Caption of the control (Text)
Tip$ = ToolTip which will appear if the mouse is left on the control
Array() = An Optionbox array (See Used variables and constants)

Value returned: If the Control was clicked then True is returned

Syntax: This control must be used in a loop. See the Option.bas example.


SUB Mtip (ID, X, Y, W, H, CptFont, CptColor&, CptStyle, Tip$)

Usage: test if the mouse stays in a predefined area (rectangle) for a predefined period, then show a tooltip

Variable description:
Id = a unique Mtip id within a loop
X% = X pos (LeftBottom)
y% = y pos (LeftBottom)
w% = width of the rectangle (area)
h% = height of the area (rectangle)
CptFont = Font Handle which contains the fontdata which will be used to print the tip (See XmsLoadFont)
CptColor& = Tip color
CptStyle = Style of the Tip (1 = Bold)
tip$ = tooltip to display

Must be used in a loop, please see Mtip.bas for more example.


FUNCTION ChKB% (ID, X, Y, CptFont, CptStyle, CptColor&, Caption$, TipFont, TipColor&, TipStyle, Tip$, Value)

Usage: If you have severals options that can be selected all at once then you need checkboxes

Variable description:
Id% = Unique CheckBox Id within a loop

X% = Xpos (LeftBottom)
y% = Ypos (LeftBottom)
Caption$ = Text to display nex to the checkbox
CptColor& = Caption color
CptFont = Font Handle which contains the fontdata which will be used to print the caption

CptStyle = Style of the caption (1 = Bold)
TipFont = Font handle for the tootip (See XmsLoadfont)
Tipcol& = color of the tip
TipStyle = Style of the tip (1 = Bold)
Tip$ = Tooltip that will be showed if the mouse is left on the checkbox
ValueHolder% = Variable that will hold the status of the CheckBox (TRue or False)

See CheckBox.bas for more infos.


FUNCTION Cmdbtn% (ID, X, Y, W, H, Cpt$, CptColor&, CptFont, CptStyle, TipFont, Tipcol&, TipStyle, Tip$, IcoBankHandle, IcoIndex, Layout, EvuMbStyle)

Usage: Create a Command button (3d button which is "clickable")

Variable description:
ID = Unique Button Id within the loop
Hotspot = LeftBottom
X% = Xpos
Y% = Ypos
W% = width
h% = Height
Cpt$ = Caption (Text on the button)
CptColor& = Caption color
CptFont = Font Handle which contains the fontdata which will be used to print the caption

CptStyle = Style of the caption (1 = Bold)
TipFont = Font handle for the tootip (See XmsLoadfont)
Tipcol& = color of the tip
TipStyle = Style of the tip (1 = Bold)
Tip$ = Tooltip
IcoBankhandle% = handle of the icon bank which contains the icon to draw on the button (See Btn)
IcoINdex% = index in the iconbank of the ico to be drawn (See Btn)
Layout = same as btn

BtnStyle = Style of the CmdBtn (for now only STyle 1 is available)

See Cmdbtn.bas for more informations.


Used variables and constants

Description of constants and variables used by EvuGUI:

The EvuGUIVariables are not useful for the programmer, it's for EvuGUI.

The Btn Routine use the following type to draw 3d buttons, to understand here is the structure of a 3d button:
BtnStructure.gif (1982 bytes)
Each border refers to a color variable in the BtnBorderColors type variable

TYPE BtnBorderColors
    Black AS LONG     (See the image)
    White AS LONG
    Dark AS LONG
    Light AS LONG
    Fill AS LONG
    Indent AS INTEGER   (When a button is pressed, the caption fo the button is slightly moved to get a real 3d effect, the indent variable is the value of this motion.)
END TYPE

TYPE Preferences
    MouseLeft AS INTEGER        (The left mouse button)
    MouseRight AS INTEGER     (The right mouse button)
    TipLBorder AS LONG           (same as the light border but for the tooltip)
    TipDBorder AS LONG        (dark)
    TipFill AS LONG                  (fill)
    InWindowColor AS LONG    (window body color)
    InControlColor AS LONG      (in control color (the white background in a cjeckbox or option box...))
    BtnStyle(1 TO 6) AS BtnBorderColors (This version of EvuGUI only includes 4 btnstyle, but there is room for 6 style here)
    TipDelay AS SINGLE    (delay before displaying a tooltip)
END TYPE

If you need to get any of the parameter within your program, read InitGUI

Before using the GUI, you must Use the InitGUI routine.


Other type:
TYPE OPTIONBOX
    X AS INTEGER             Xpos of the option box
    Y AS INTEGER             Ypos of the option box
    Value AS INTEGER      Status of the option box (True/False)
    OptLast AS INTEGER   'Used by EvuGUI
END TYPE

Header of a Bsaved file:
TYPE BHeader
    Header AS STRING * 1
    Segment AS INTEGER
    Address AS INTEGER
    Length AS INTEGER
END TYPE

These two variables are used by EvuGUI, please don't change their values:
EvulgoWrapVar

EvulgoTextHolder

The Done Variable:
This variable is very important, if true, it tels EvuGUI that the current loop has been "looped" one time, so there's no need to redraw all the controls which works in a loop, Example:

DO
    [controls]
Done = True
LOOP

If The "Done = True" line is omitted then all the control will be redrawn in the loop...
If You want a complete example using the main routines of EvuGUI v1.00, run Demo.bas


Contact infos

You can contact me by:

Visit my Website: http://lgmlabs.8m.com and let me have your feedback!

By Anben Panglose for LGM Labs (C)opyright 2001.