forums

TNT Basic Forums > Bugs!
Bug With Buttons?
< Last Thread     Next Thread >
Author
Thread        Post A Reply

01-17-2006 23:59

Posted by:
Maher Haddad

Find more posts by Maher Haddad

Version 1.3 seems to be giving me trouble when trying to make buttons. I've been trying to create buttons using the masking feature so the button appears invisible and when the mouse is moved over it a frame appears over the text. Unfortunately it doesn't work most of the time. I've checked everything and double checked everything to confirm that everything is done correctly but to no avail. The button does not appear at all when I run the program. Has anyone else been having this problem?

Maher

01-18-2006 11:35

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Sounds more like a mask thing...

I think I'm with you here, but correct me if I'm not. You've got buttons with text on, and you just want the text to do something on roll over. You're masking the rest of the button so that only the text is visible and you're not getting a 'hit' when you expect it?
I suspect that it is probably a detection error, rather than an error with the call, as it seems from your post to be an intermittant problem. If anyone else has had this trouble then please let us know.
First thing I'd do is to write a little prog which displays one of your buttons and does nothing but loop until it detects a hit. By checking things as frequently as possible it will tell you if the call is working or not. If this fails, draw up a quick sprite, say a circle in a rectangle, and mask it so that only the circle appears and try it with this. This will narrow it down to the call, rather than the text being too small to register a consistant collision. If neither of these work, check the settings for the images you are using to represent the buttons.

Are you in hardware mode?

If they do work, it's the frequency of your checks or the area being too small to accurately detect the hit.

If all this fails, try using point in rect to detect the roll over and change the sprite image manually, bypassing buttons altogether. If you need to do exact collisions you could poll the colour under the mouse cursor, and if it's not background (when the cursor is in the box) then it's text, so you've got your 'hit'.

Give these ideas a go and let us know how you get on. If it turns out to be a problem with the call then I will obviously look into it when I get back onto a Mac (which will hopefully be very soon... god I hate Windoze!)

Danny (nods)

01-18-2006 22:32

Posted by:
Maher Haddad

Find more posts by Maher Haddad

Thank You.

I believe that I figured out the problem. After posting the message last night and fiddling with it some more I figured out that the New Button command only works if something is being done with that button.

For example:

New Button 1,545,145,0,1,1,100
New Button 2,545,205,0,1,1,100
New Button 3,545,265,0,1,1,100
New Button 4,545,509,0,1,1,100

the new buttons do not appear.

When I added the following code after creating the buttons it worked:

int quit=false
While not quit
int but=Poll Button Click
if but=1
About()
else if but=2
Profiles()
else if but=3
Select()
else if but=4
quit=true
end
end if
wend


I didn't realize that we needed to work out what the buttons do before they function. I thought I could move the mouse over the button and the text would be highlighted without having to give functionality to the button. Apparently it doesn't work that way which is unfortunate as I like to make sure the buttons are lined up properly before working with them. Oh well.

01-18-2006 22:48

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Did you 'Draw Frame'?

Try refreshing the screen after defining the buttons and see if this helps... Remember that buttons are basically just sprites with additional functionality.

Danny (nods)

01-19-2006 15:49

Posted by:
Maher Haddad

Find more posts by Maher Haddad

One of my attempts before starting this thread was trying Draw Frame. Apparently TNT Basic doesn't handle buttons just by themselves without giving them a function and using poll buttonclick.

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.