Turbo Pascal Development Toolkit V 1.1
The unit gui has all the sorce code needed for makeing you programes look like windows aplications.
The demo file will show you how to uses the unit
the mouse file is need both by the gui unit and by the program you create
any probles contact me at [[Email Removed]]
I Get a lot of junk mail so title you e-mail.
www.get-me.to/riddlershttp://www.geocities.com/riddersempire/
due to the request to have a turtorail page to use this unit i have compiled it below.
first put the gui.tpu and mouse.tpu files in the the folder where your other units are
fist section section 1. IN THIS SECTION YOU LEAR HOW TO USE BUTTONS SHOW THE DESKTOP AND OPEN GRAPH MODE
before you do anything you need to open the graph mode to do this enter the line below
initvga; {for this to work you need evabga.bgi file in the bgi folder.
if you dont have the bgi folder use the one provided.
if the initvga mode does not start you need to enter the edit the gui.pas file and cange the lines
procedure initvga;
var a,b : integer;
begin
a:=detect;
InitGraph(a,b,'.\bgi');
{set graph mode}
end;
All you need to change is the line InitGraph(a,b,'.\bgi');
change the .\bgi to the location of the evavga.bgi
one you get that you work your ready to go.
Now lets get started;
first lets display the destkop.
Display_Desktop; {this show the desktop}
Now lets put some button on the screen. dont be afraid by the code it is very easy.
First we need to have a variable for the button.
Var Bok : Bobject; {this is the button object};
bcancel : boject;
Now to use the button you need a repeat loop. this loop will quit when the button is pressed.
so lets go.
uses crt,graph,mouse,gui;
Var tab: shortint;
i : char;
bok,bcancel : bobject;
Begin
initvga;
display_desktop;
showmouse; {display the mouse on screen}
Tab:=1; {this set the curent button select by the keyboard}
bok.init(50,50,250,150,1,'Ok',green,1);
bcancel.init(300,50,500,150,2,'Cancel',green,1); {the first 4 vars are the buttons coridnts on the screen x,y,x1,y1
x,y------------x1,y
: :
: :
: :
x,y1-----------x1,y1
then next one is the tab order then the next one is the button name. the next one is button color and the last one between
0 and 1 0 is normal button 1 is butten with curved edges}
Repeat
I := Chr(255); {this set the key back to nill do not change unless you realy know what you are doing}
If Keypressed Then
I := Readkey; {this just gets the key wtich are pressed on the keyboard this is very importet as it is needed for
the tab fuctions and textboxes will not work without it. it also do not wait for a key pressed so it is idle for games
also}
If I=Chr(9) Then Inc(Tab); {if the tab button is pressed then move the tab to the next one}
If I=Chr(15) Then {if the tab and shift button is pressed the move the tab back one}
Tab:=Tab-1;
if tab<=0 then tab := 2;
if tab>2 then tab:=1; {these set the limit to the tabs the buttons and textboxes, items that you what to be able to tab between
so if you have more than 2 change the value 2 to how many items you have}
bcancel.run(tab,i);
bok.run(tab,i); {this will run all the code for the button everything. the vale 1 is what order you what the button to be in
the tab form. what i meen is when you press the tab putton on the keyboard it will sitch between them. and the variable tab
is the current button seleted}
Until bok.clicked;{note you can have bok.pressed or bok.clicked i got a bit confuesd when i programed this i a carnt remember
which is which. one will be when you presses the button and then let go, and the other will be one that works as soon as you
press it.}
End.
END OF SECTION 1
SECTION 2 IN THIS SECTION YOU LEAR HOW TO USE THE TEXT BOXES AND TO CHECK THE DATA IN THEM
{NOTE THIS IS ONE BUG WIHT THE TEXT BOX OBJECT IT DOES NOW WORK IF YOU HAVE CAPS LOCK. I HAD TO DISAPBLE CAPITAL LETERS SO
THAT YOU CAN NAVIGATE THOUGHT THE TEXTBOX WITH THE KEYBOARD. I KNOW HOW TO RETIFIY THE PROBLEM BUT I HAVE NOT HAD THE CANCE JUST JET. THEREFORE DONT FORGET TO TURN CAPS OF. IF ANY ONE FIXES THE PROBLEM PLESES SEND ME THE AMENDA VERSON.
uses crt,graph,mouse,gui;
Var tab: integer;
i : char;
bok,bcancel : bobject;
nameb : ttextbox;
Begin
initvga;
display_desktop;
showmouse; {display the mouse on screen}
Tab:=1; {this set the curent button select by the keyboard}
nameb.init(20,100,120,120,3); {First 4 variables are the cordints last one is
tab possision in the tab order}
bok.init(150,50,250,100,1,'Ok',green,1);
bcancel.init(300,50,400,100,2,'Close',green,1); {the first 4 vars are the buttons coridnts on the screen x,y,x1,y1}
{
x,y------------x1,y
: :
: :
: :
x,y1-----------x1,y1
then next one is the tab order then the next one is the button name. the next one is button color and the last one between
0 and 1 0 is normal button 1 is butten with curved edges}
Repeat
I := Chr(255); {this set the key back to nill do not change unless you realy know what you are doing}
If Keypressed Then
I := Readkey; {this just gets the key wtich are pressed on the keyboard this is very importet as it is needed for
the tab fuctions and textboxes will not work without it. it also do not wait for a key pressed so it is idle for games
also}
If I=Chr(9) Then Inc(Tab); {if the tab button is pressed then move the tab to the next one}
If I=Chr(15) Then {if the tab and shift button is pressed the move the tab back one}
Tab:=Tab-1;
if tab<=0 then tab := 2;
if tab>3 then tab:=1; {these set the limit to the tabs the buttons and textboxes, items that you what to be able to tab between
so if you have more than 2 change the value 2 to how many items you have}
nameb.run(tab,i);
bok.run(tab,i);
bcancel.run(tab,i);
{this will run all the code for the button everything. the first vale the cureent tab selected
and the last one is the imput for the keyboard what order you what the button to be in
the tab form. what i meen is when you press the tab putton on the keyboard it will sitch between them. and the variable tab
is the current button seleted}
if bok.clicked then {check to see if the buton is pressed}
if nameb.textstring='test' then {if the data entered in the text box = test}
error_box(100,100,300,300,'Data entered correct','','',True)
Else error_box(100,100,300,300,'Data entered InCorrect','Please Re-Enter','',True);
{first 4 variables are the coridnts to display on screen
the next 3 are the error message to display on screen
the last one is if you want the internal speker to bleep
set it to true to bleep and false to swith it off}
Until bcancel.clicked;{note you can have bok.pressed or bok.clicked i got a bit confuesd when i programed this i a carnt
remember which is which. one will be when you presses the button and then let go, and the other will be one that works
as soon as you press it.}
End.
NOTE YOU CAN SAVE THE DATA IN THE TEXT BOXES BY JUST GETING THE DATA OUT OF THE TEXT BOX BY UNSING NAMEB.TEXTSTRING
END OF SECTION 2
SECTION 3 IN THIS SECTION I WILL TEACH YOU HOW TO USES DROPDOWN MENUS COOL AY THEY ARE SLIGHTLY HARDER BUT EVEN A NOVICE
SHOULD BE ABLE TO USE THEM.
uses crt,graph,mouse,gui;
Var tab: integer;
i : char;
bok,bcancel : bobject;
nameb : ttextbox;
Dropdownmenu1 : ddmobject;
Begin
initvga;
display_desktop;
showmouse; {display the mouse on screen}
Tab:=1; {this set the curent button select by the keyboard}
dropdownmenu1.tbutton[1]:='check'; {name of first button on drop down menu}
dropdownmenu1.tbutton[2]:='Close'; {name of second button on drop down menu}
{to add more button cange variable eg tbutton[x]:='???'; where X in the button
number for top to bottom. NOT CHANG THE VARIABLE IN THE INIT PROCEDURE TO ADD
MORE BUTTONS. EG Dropdownmenu1.init(1,1,100,20,Y,'file',green);
Where Y is the number of buttons}
{NOTE YOU MUST SET THE BUTTON NAME FIST THEN RUN THE INIT CODE}
Dropdownmenu1.init(1,1,100,30,2,'file',green); {first 4 vars are cordnts of
the first button. Note the other buttons are calcuated artomaticly
the next var is the number of button on the menu and the last var is the
colour}
nameb.init(20,100,120,120,3); {First 4 variables are the cordints last one is
tab possision in the tab order}
bok.init(150,50,250,100,1,'Ok',green,1);
bcancel.init(300,50,400,100,2,'Close',green,1); {the first 4 vars are the buttons coridnts on the screen x,y,x1,y1}
{
x,y------------x1,y
: :
: :
: :
x,y1-----------x1,y1
then next one is the tab order then the next one is the button name. the next one is button color and the last one between
0 and 1 0 is normal button 1 is butten with curved edges}
Repeat
I := Chr(255); {this set the key back to nill do not change unless you realy know what you are doing}
If Keypressed Then
I := Readkey; {this just gets the key wtich are pressed on the keyboard this is very importet as it is needed for
the tab fuctions and textboxes will not work without it. it also do not wait for a key pressed so it is idle for games
also}
If I=Chr(9) Then Inc(Tab); {if the tab button is pressed then move the tab to the next one}
If I=Chr(15) Then {if the tab and shift button is pressed the move the tab back one}
Tab:=Tab-1;
if tab<=0 then tab := 2;
if tab>3 then tab:=1; {these set the limit to the tabs the buttons and textboxes, items that you what to be able to tab between
so if you have more than 2 change the value 2 to how many items you have}
DropDownMenu1.Run(i); {all this neads is the input for the keyboard}
if dropdownmenu1.obutton[1].clicked then {if the 1st button is pressed in menu}
begin
dropdownmenu1.close; {this closes the menu}
if nameb.textstring='test' then {if the data entered in the text box = test}
error_box(100,100,300,300,'Data entered correct','','',True)
Else error_box(100,100,300,300,'Data entered InCorrect','Please Re-Enter','',True);
{this is just the same code a below}
End;
nameb.run(tab,i);
bok.run(tab,i);
bcancel.run(tab,i);
{this will run all the code for the button everything. the first vale the cureent tab selected
and the last one is the imput for the keyboard what order you what the button to be in
the tab form. what i meen is when you press the tab putton on the keyboard it will sitch between them. and the variable tab
is the current button seleted}
if bok.clicked then {check to see if the buton is pressed}
if nameb.textstring='test' then {if the data entered in the text box = test}
error_box(100,100,300,300,'Data entered correct','','',True)
Else error_box(100,100,300,300,'Data entered InCorrect','Please Re-Enter','',True);
{first 4 variables are the coridnts to display on screen
the next 3 are the error message to display on screen
the last one is if you want the internal speker to bleep
set it to true to bleep and false to swith it off}
if dropdownmenu1.obutton[2].clicked then bcancel.clicked:=true;
{if the 2 button on menu pressed then force the cancel button to be true
this is the last line of code so that the bcancel can not be swicted back
to false when ruing the bcancel.run proceder}
Until bcancel.clicked;{note you can have bok.pressed or bok.clicked i got a bit confuesd when i programed this i a carnt
remember which is which. one will be when you presses the button and then let go, and the other will be one that works
as soon as you press it.}
End.
END OF SECTION 3
other procedrues are as followed. at the moment there is not tutorial for them but if you undersand the first 3 sections
you will easyly be able to work out the rest.
procedure squarof(x,y,x1,y1 : integer); {group items together}
procedure newwindow(x,y,x1,y1 : integer); {a new window at (x,y,x1,y1)}
procedure taskbar(x,y,x1,y1 : integer; outtext : String); {a task bar}
procedure error_box(x,y,x1,y1 : integer; output,output1,output2 : string; soundon : boolean);
{a pop up error dialog box where outputs are the messages and if sound = true then it will bleep}
procedure comformation(x1,y1,x2,y2 : integer; Title,line1,line2 : string;var yesno: boolean; textcol : word);
{A pop up conformation box with ok and cancel buttons}
Procedure Display_Desktop; {display a desktop}
procedure new_box(x,y,x2,y2,col : integer); {like new window}
procedure show_box(x,y,x1,y1 : integer; output : string); {like a text box but the text is read only}
Procedure Panal(X,Y,X1,Y1 : Integer);
ther are also tick boxes and lots more. check out the gui code
Thank you for download this and enjoy.
CHECK OUT http://www.geocities.com/riddersempire/ FOR UPDATES, AND TUTORIALS ON ALL EVEN GAMES.
PS THE SITE IS UNDER CONSTUTION SO DONT BE PUT OF BY HOW IT LOOKS.