WizGui ZX Gui library for Qbasic
Copyright © 2003, WizINC. Visit our homepage at http://www.hot.ee/wizgui.
Created by Albert Varaksin

How to use WizGui ZX

Commands

Window Commands
Button Commands
TextBox commands
System Command
Drawing Command
Text commands


About WizGui ZX WizGui ZX is Gui (Graphical user interface) for Qbasic. It provides to its user a possibility to easily create and use windows, buttons, textbox and etc. in qbasic made programs. Windows are fully multitasked and each window can contain different program what has nothing to do with other windows. WizGui ZX is written in qbasic using Future.Library 3.5. I have used Qbasic quite a long time since I was quite young so about 11 years old so - for now about 7 years. In that time I have tried several times to make something like that. But I must say that my first attempts were quite pathetic. Programs were written in SCREEN 9. Windows of course were not moveable or so on. They were more just pictures on the screen. Then about two or three years ago I found Future.Library and ofcourse I was getting older and smarter so I thought that using library I could write something more effective. My first movable window was written just between DO and LOOP cycle without any sub routines. But since that I believe I have improved. WizGui XZ is about fourth edition of WizGui family. Enjoy!


What's new in this version


Starting WizGui ZX To start WizGui ZX library you have to start Qbasic with future.Library and to open a fail wizgui.bat.


Using WizGui ZX


Window Commands

SUBs/FUNCTIONs:
SUB SetWindow (Xpos, Ypos, XSize, YSize, Title$, WinID) - creates a new window on the screen. WinID - identification number of the window. Every window must have a fiffrent WinID!
SUB CloseWindow (WinID) - Closes a specific window and deletes it's contents (by WinID)
SUB SetActiveWindow (WinID) - Brings specific window to front and set it active
SUB DefWin (WinID) - start's window definatiot cycle
SUB EndDefWin () - end's window defination cycle
SUB HideWindow (WinID) - hide's specific window
SUB HideWindows () - hide's all windows
SUB ShowWindow (WinID) - show's specific window
SUB ShowWindows () - show's all hidden windows
SUB ReFreshWindows () - refreshes window contents. useful when you change a color theme.
SUB DeleteWindowContents (WinID) - delete specific window contents - buttons, textboxes and so on.
FUNCTION FreeWindow () - get's free windo ID number
FUNCTION WinX(WinID) - get's a lenght in pixels window left outside border from left side of the screen
FUNCTION WinY(WinID) - get's a lenght in pixels window upper outside border from top of the screen
FUNCTION WinX1(WinID) - get's a lenght in pixels window right outside border from left side of the screen
FUNCTION WinY1(WinID) - get's a lenght in pixels window bottom outside border from left side of the screen
FUNCTION WinXSize(WinID) - Get's window internal size in X tangle (in pixels)
FUNCTION WinYSize(WinID) - Get's window internal size in Y tangle (in pixels) FU
FUNCTION X(WinID) - get's a lenght in pixels window left inside border from left side of the screen
FUNCTION Y(WinID) - get's a lenght in pixels window upper inside border from top of the screen
FUNCTION X1(WinID) - get's a lenght in pixels window right inside border from left side of the screen
FUNCTION Y1(WinID) - get's a lenght in pixels window bottom outside border from left side of the screen

Useful Window variables:
VARIABLE Win(WinID).Status - shows window status. if -1 then window is hidden, 0 - not exist's, 1 - is not active 2 - is active
VARIABLE Win(WinID).DisableCloseOption - if you put this True then possibility to close window by pressing F4 and window closebutton are disabled
VARIABLE ActiveWin - gives ID of active window. if no active window then it's value is 0
VARIABLE NofW - maximum number of windows.
VARIABLE Win(WinID).Title - window title.


Button Commands

SUBs/FUNCTIONs:
SUB SetButton (Xpos, Ypos, Title$, WinID, ButID) - creates a new button in to the specific window (WinID). As Windows so do have Button it's own ID -ButID.
SUB SetAdvButton (Xpos, Ypos, XSize, YSize, Title$, WinID, ButID) - Similar to SetButton only you can set any size of the button by XSize and YSize
SUB DefButton (WinID, ButID) - You can definate button. Change it's look or pu pictures on it.
SUB EndDefBut () - end's button defination
SUB BMP2Button (File$, Xpos, Ypos, WinID, ButID) - Put's BMP file on the button
SUB DeleteButton (WinID, ButID) -Deletes specific button.

Useful Button variables:
VARIABLE But(WinID, ButID).Status - shows Button status. 0 - not exist's, 1 - not pressed 2 - pressed


TextBox Commands

SUBs/FUNCTIONs:
SUB SetTextBox (Xpos, Ypos, Lenght, WinID, TbID) - Creates new TextBox into the specific window. TbID -TextBox identification number, Lenght - size of the textbox.
SUB DeleteTextBox (WinID, TbID) -Deletes specific TextBox.

Useful TextBox variables:
VARIABLE Tb(WinID).Status - shows TextBox status. 0 - not exist's, 1 - is not active 2 - is active (you are writing in to it)
VARIABLE TbText(WinID, TbID) - gives a value from specific textbox (string what you wrote)
VARIABLE Tb(WinID, TbID).PasswordType - if True then textbox is set to password type so text what you write is not visible.


System Commands

SUBs/FUNCTIONs:
SUB Initalise () -Start's wizGui. Set's screennode, allocates memory and check's system requements.
SUB RunSystem () -Main sub what run's all WizGui ZX work. It must be placed between DO and LOOP cycle.
SUB EndGui () -End's wizgui work. Deallocates memory and swich screen mode back to normal.
FUNCTION WizGuiVersion$() - get's wizGui verion
FUNCTION WizGuiCodename$() -Get's wizGui codename

Useful system variables:
VARIABLE Theme$ - active rheme.
VARIABLE Deph - color deph
VARIABLE Xres - screen X resolution
VARIABLE Yres - screen Y resolution
VARIABLE SWCWD - show window contents while dragging. If True then shows. VARIABLE Key$ - if key on keyboard is pressed then it's value is given to Key$
VARIABLE MouseX - Currect mouse position on X tangle
VARIABLE MouseY - currect Mouse position on Y tangle
VARIABLE MouseL - if mouse left button is pressed then it's value is True
VARIABLE MouseR - if mouse right button is pressed then it's value as True
VARIABLE OldMouseX - Mouse position on X tangle on previous tact
VARIABLE OldMouseY - Mouse Position on Y tangle on previous tact


Text Commands

SUBs/FUNCTIONs:
SUB SetTextLoc (Xpos, Ypos, WinID) - Sets text cursor location.
SUB SetTextColor (FgColor, BgColor) - like normal color statament. if FgColor = -1 then theme text color is used. If BgColor = -1 then text background is transperent.
SUB SetText (Text$) - Print's text to the window.
SUB SetSmartTextArea (Xpos, X1pos, WinID) -set's smart text virtual windows(text wrapping).
SUB SetSmartText (Text$) - Set's smart text -wrap's at the end of the window or virtual window.
SUB SetTextFont (File$) -Set font.

Useful text variables:
VARIABLE CursorX - Cursor X position in window
VARIABLE CursorY -Cursor Y position in window
VARIABLE CursorWinID - Show's in wich window cursor is located


Drawing Commands

SUBs/FUNCTIONs:
SUB PaintWin (C&, WinID) - Paint's window
SUB DrawBox (Xpos%, Ypos%, XSize%, YSize%, C&, WinID%)
SUB DrawBox3D (Xpos%, Ypos%, XSize%, YSize%, Style%, WinID%)
SUB DrawFillBox (Xpos%, Ypos%, XSize%, YSize%, C&, WinID%)
SUB DrawFillBox3D (Xpos%, Ypos%, XSize%, YSize%, Style%, C&, WinID%)
SUB DrawCircle (Xpos%, Ypos%, R%, C&, WinID%)
SUB DrawFillCircle (Xpos%, Ypos%, R%, C&, WinID%)
SUB DrawLine (Xpos%, Ypos%, X1pos%, Y1pos%, C&, WinID%)
SUB DrawHLine (Xpos%, Ypos%, XLenght%, C&, WinID%)
SUB DrawVLine (Xpos%, Ypos%, YLenght%, C&, WinID%)
SUB DrawHLine3D (Xpos%, Ypos%, XLenght%, WinID%)
SUB DrawVLine3D (Xpos%, Ypos%, YLenght%, WinID%)
SUB DrawPset (Xpos%, Ypos%, C&, WinID%)
SUB BMP2Window (FailName$, Xpos%, Ypos%, WinID%)

How to get a color?
Color is given by C& - to get the color you can:
1) C& = RGB2Color(R%, G%, B%) '-where r,g,b are intensivity of red, green and blue. their values can be between 0 and 255.
2) C& = GetColor(number) ' -8 bit color system. There are 16 color's from 0to 15. These are most common color's what you find in qbasic normal screen mode (0, 9, 12, 13). but works at any color deph.