PDA

View Full Version : Buttons taking the focus


coreys
12-26-2007, 10:55 PM
I can't seem to figure out how to make GuiButtonCtrl's not take the focus. Whenever you login or when the script is updated on my main gui the buttons take the focus, forcing you to spam your keyboard with tab and arrow keys to be able to talk again. I've tried everything I could think of. I've set the profiles to have cankeyfocus=false, I've tried makeFirstResponder(), both true and false, and I've tried closequery=true.

Any suggestions?

And, on a rather unrelated note, is there a way to use the players gui style for gui controls?

Inverness
12-26-2007, 11:46 PM
Try GraalControl.makefirstresponder(true);

coreys
12-27-2007, 12:40 AM
Try GraalControl.makefirstresponder(true);

I did :(

cbk1994
12-27-2007, 12:49 AM
if ( x.isFirstResponder() )
{
GraalControl.makeFirstResponder( true );
}


Something like this in a timeout? Poor optimization, but may work in a system script where there is already a timeout.

coreys
12-27-2007, 01:24 AM
Ah, I did something similar to that and it worked, thanks.

But, yeah, I don't suppose it's possible to read the players current gui style and use it in GUI Controls, is it?

Inverness
12-27-2007, 02:57 AM
GuiControlObject.style = $pref::video::defaultguistyle;

If its not done automatically, which it should be unless style == ""

zokemon
12-27-2007, 04:58 AM
The button profiles need to have the following (either with useownprofile = true or having profile = a profile with these):
profile.tab = false;
profile.cankeyfocus = false;

I actually just modify GuiButtonProfile with those as I believe it to be one of the most annoying features on Graal and should be off by default...

napo_p2p
12-27-2007, 05:00 AM
I found that when the Graal taskbar is hidden, then there are much less problems with gui controls taking focus. Not sure if that is an issue with the client or not.

Admins
01-02-2008, 12:57 PM
Normally you just set


useownprofile = true;
profile.modal = false;


The button cannot be clicked then though. You can also set some other attributes:

profile.focusonshow = false;
profile.tab = false;
profile.cankeyfocus = false;


You can also unset the focus when your button receives the focus:

function onFirstResponderChanges(obj) {
if (obj==MyButton && obj.isFirstResponder())
GraalControl.makeFirstResponder(true);
}

Chompy
01-02-2008, 03:33 PM
Normally you just set


useownprofile = true;
profile.modal = false;


The button cannot be clicked then though. You can also set some other attributes:

profile.focusonshow = false;
profile.tab = false;
profile.cankeyfocus = false;


You can also unset the focus when your button receives the focus:

function onFirstResponderChanges(obj) {
if (obj==MyButton && obj.isFirstResponder())
GraalControl.makeFirstResponder(true);
}


Very nice Stefan :p That Fixed some stuff on my server :D! <3