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.

DarkBASIC Discussion / Form Function help! Setting window priority??

Author
Message
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 25th Feb 2009 17:43
ok well I'm making a set of functions for making windows forms(kinda like magic windows but more windows looking) and i have buttons and moving the forms around. but if you click on one form and theres a button behind it on another form it will click it.

Right now the form priority is set up by the number of the form. but it still has the button clicking problem lol I'm not sure what to do.

i wish there was a set sprite priority command for dbc lol

heres a screeny and the update window code





any other ideas would be appreciated also
btw if you want the hole code i can attach it (no media required)
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 25th Feb 2009 22:10
check out

Dark Windows

Enjoy your day.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 26th Feb 2009 04:17
while i have looked at this before and it is interesting how does this apply to window priority?


and i downloaded it but it only has checkboxes and radio buttons? lol i thought there was buttons?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 26th Feb 2009 05:58
I could've sworn there were buttons too! Maybe that's the wrong link... Anyway, if you find the button one, RobertTheRobot had a method of prioritizing the buttons so the one on top was the one to click.

What about just creating a CurrentlyActive flag? If CurrentlyActive is true and the selection is such n such then proceed.

Enjoy your day.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 26th Feb 2009 06:06
yes true wait i think i worked to long on it i was thinking to much into it. it sounded really hard earlier hahaha thats not that hard! hahaha.

what do you think about putting 1 window infront of the other? because dbc doesn't have set sprite priority command what do you think?
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 26th Feb 2009 06:22 Edited at: 26th Feb 2009 06:23
As I recall, darkbasic draws the sprites on top of those that were created first. So to set priority, I think you can just Place the sprite on top (I think, but I haven't done a lot with sprites in a while).

My usual copout is to take a screen shot of everything- the sprite of the window you will be in, then just use PASTE SPRITE for that and put the sprite wherever you need to. It will LOOK the same, but you won't do much with the others. You would probably need some sort of collision boxes set up so that you can see which window the mouse WOULD be over to switch to a new one.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 26th Feb 2009 06:32 Edited at: 26th Feb 2009 06:44
yes sprite priority is setup by the sprite number (e.g. 1 is the bottom sprite 2 is above that and so on)

my problem is i'm checking to see if the mouse is inside the window and if theres a window behind it in the area then it says you clicking on both :/
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 26th Feb 2009 07:13
You can keep all of the windows in order of priority in an array, then just run through the list to see which one gets the highest priority.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 26th Feb 2009 18:48
hmmmm good idea.


but the proglem still persists that if i check if the mouse is inside the window and you click and your on 2 windows(e.g. the windows are in the same place) it says your in both windows
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 26th Feb 2009 18:54
What I meant was you check which windows it COULD be in, then you check those against an array. The Array would be referenced where the stored value is the windows priority, so that you can reference it easily. It would look like this (pseudo-code):

Check for windows mouse is in
Store those in an array
Look at those locations in the priority array
Choose the window with the highest (or lowest) priority
Set that window to The active priority and shift everything else down 1 (so that the last used window will be second priority but the new one becomes the main window)

Does this make sense? Or am I misunderstanding and this is completely irrelevant?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 26th Feb 2009 22:35
ok i see now that makes perfect sense thanks!


i will try and put this in and tell you how it goes!

Login to post a reply

Server time is: 2025-05-18 22:38:38
Your offset time is: 2025-05-18 22:38:38