Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Simple button function

Author
Message
tiffer
18
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 12th Apr 2006 17:04 Edited at: 21st Apr 2006 20:56
Hey this is a little code i wrote to help beginners with their interfaces. Note that it only works in if its included in a program loop.



now if you paste that at the bottom of your program or even better, if you have dba pro then create an include file by going to files and add new. Then you use lbutton(xcoordinate,ycoordinate,"button label") !in an if condition only!

eg if lbutton(300,300,"push me")=1 then print "oh yeah". Hope you like it i dont normally give programs away.

eg




edit
ooops forgot you#ll need this function aswell


Cwatson
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 19th Apr 2006 16:28 Edited at: 19th Apr 2006 16:31
hmmm, it only works partly for me. I get the button, but when I click on it no text come up.


Any part Ive missed???

EDIT:

I copied your code right of, so I dont get whats wrong.
tiffer
18
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 20th Apr 2006 19:27
You used the function properly but you,e made a simple error with your program.

You are suspending the program after writing the text , but their is no sync to refresh the screen



Cwatson
MartinS
18
Years of Service
User Offline
Joined: 15th Dec 2005
Location: Rochester, NY
Posted: 20th Apr 2006 19:43
I don't see a thing... Well, unless ou count black! Using 5.9

Martin

Black Mesa
18
Years of Service
User Offline
Joined: 25th Mar 2006
Location:
Posted: 21st Apr 2006 06:02
Quote: " I don't see a thing... Well, unless ou count black! Using 5.9"


Did you sync?
MartinS
18
Years of Service
User Offline
Joined: 15th Dec 2005
Location: Rochester, NY
Posted: 21st Apr 2006 07:42
I just tried running your example program... (with the other function added, of course!)

Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 21st Apr 2006 17:39 Edited at: 21st Apr 2006 17:39
Still wont work. Dont know whats wrong, I synced it.


It detects the click (I put an "end" in it to check just that), but it wont print out the text.
tiffer
18
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 21st Apr 2006 21:13
I made a slip up, dont worry too much about the example, as long as you know the button works you can use it in other ways, i just wasn't thinking when i put the example together. I'll explain what's happening and where i went wrong and we can all learn from it.

ok the loops starts by clearing the screen. Then the button is drawn to screen by the button function,and then aided by a sibling function it tests if the mouse is over the button and if the mouse button is pressed.

When the button is pushed it starts a another block of code which is where the problems start.

This block of code prints the text and suspends before the screen is refreshed and as soon as you press the key the loop restarts and clears the screen in the blink of an eye.

heres a better example


Cwatson
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 22nd Apr 2006 13:13 Edited at: 22nd Apr 2006 13:13
Well, the button function works fine, but I still cant make it work with the printing part. Anyway, its a nice function.

EDIT:

Replace the "print" with an "end", and youll see.
tiffer
18
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 23rd Apr 2006 00:26
It's ok, i've been using these button functions faithfully for quite a while

Cwatson

Login to post a reply

Server time is: 2024-11-27 21:37:53
Your offset time is: 2024-11-27 21:37:53