Does a Checkbox care how long you press it?
1 Attachment(s)
Or am I seeing something else here?
I've been working on some more features for a browser window. Any window with a dropdown menu always has problems with keyboard focus. Anytime the window has focus the space bar causes the dropdown menu to open, which is not normally what you want. To work around this I've been putting set_focus Parent...Parent.Player.Fullpath commands in every button in the window to switch the focus to the player window. This has worked for every button, it seems, except for the minimize Checkbox: <Checkbox BackgroundOpacity="1.000" LocalTooltip="Mimimize" Name="Minimize" OnSet="OldSize=Parent.Parent.Parent.Parent.Size Parent.Parent.Parent.Parent.MinimumSize=325,27 Parent.Parent.Parent.Parent.Size=325,27 Parent.Parent.Parent.Parent.UserResizable=false set_focus Parent.Parent.Parent.Parent.Parent.Player.Fullpath LocalTooltip=Restore" OnUnset="Parent.Parent.Parent.Parent.MinimumSize=600,150 Parent.Parent.Parent.Parent.Size=OldSize Parent.Parent.Parent.Parent.UserResizable=true set_focus Parent.Parent.Parent.Parent.Parent.Player.Fullpath LocalTooltip=Minimize" ScrollExtent="13,9" Size="13,9" Style="ShowControl.Style"></Checkbox> The line set_focus Parent.Parent.Parent.Parent.Parent.Player.Fullpath is supposed to switch focus to the player window but a normal click doesn't work. After a lot of trial and error I found out that if I click down on the button for longer than a couple tenths of a second it does switch focus but a normal quick click doesn't. Has anyone run into this problem or something similar? Here's the xml file if you want to try it. |
I haven't played in a while but the way I recall it:
1st. the OnActivate is called instantly everytime when you click on a button/checkbox 2nd. The OnPress or OnSet doesn't get called until you let go of the mouse button. In other words, if you move the mouse off of the button before letting go of the button, you can cancel the click. 3rd. The OnDeactivate gets called everytime I don't think that helps but it does help explain the buttons.. I'm not sure what goes on if you hold the button down on a checkbox. You can try putting the set_focus in the OnDeactivate and see what happens. Edit: I'm not 100% sure a checkbox works like a button though. I used to use 2 buttons for minimize/restore with the same size and location The minimize button would hide itself and show the restore button (OnSet event) The restore button would hide itself and show the minimize button (OnUnset event) |
I tried putting the set_focus command into OnPress and it still does the same thing.
<Checkbox BackgroundOpacity="1.000" LocalTooltip="Mimimize" Name="Minimize" OnPress="set_focus Parent.Parent.Parent.Parent.Parent.Player.Fullpath" OnSet="OldSize=Parent.Parent.Parent.Parent.Size Parent.Parent.Parent.Parent.MinimumSize=325,27 Parent.Parent.Parent.Parent.Size=325,27 Parent.Parent.Parent.Parent.UserResizable=false LocalTooltip=Restore" OnUnset="Parent.Parent.Parent.Parent.MinimumSize=600,150 Parent.Parent.Parent.Parent.Size=OldSize Parent.Parent.Parent.Parent.UserResizable=true LocalTooltip=Minimize" ScrollExtent="13,9" Size="13,9" Style="ShowControl.Style"></Checkbox> Stripping the scripts of everything else: <Checkbox BackgroundOpacity="1.000" LocalTooltip="Mimimize" Name="Minimize" OnSet="set_focus Parent.Parent.Parent.Parent.Parent.Player.Fullpath" OnUnset="set_focus Parent.Parent.Parent.Parent.Parent.Player.Fullpath" ScrollExtent="13,9" Size="13,9" Style="ShowControl.Style"></Checkbox> Using "=" style commands: <Checkbox BackgroundOpacity="1.000" LocalTooltip="Mimimize" Name="Minimize" OnSet="set_focus=Parent.Parent.Parent.Parent.Parent.Player.Fullpath set_focus=Parent.Parent.Parent.Parent.Parent.Player.Fullpath" OnUnset="set_focus=Parent.Parent.Parent.Parent.Parent.Player.Fullpath set_focus=Parent.Parent.Parent.Parent.Parent.Player.Fullpath" ScrollExtent="13,9" Size="13,9" Style="ShowControl.Style"></Checkbox> Pressing a button at the first level of the window: <Checkbox BackgroundOpacity="1.000" LocalTooltip="Mimimize" Name="Minimize" OnSet="Parent.Parent.Parent.Parent.SetFocusToPlayerWindow.Press=true" OnUnset="Parent.Parent.Parent.Parent.SetFocusToPlayerWindow.Press=true" ScrollExtent="13,9" Size="13,9" Style="ShowControl.Style"></Checkbox> ... <Button Name="SetFocusToPlayerWindow" OnPress="set_focus Parent.Parent.Player.Fullpath" Size="0,0" Visible="false"/> |
VICTORY!
Changing to two toggling Buttons: <Button BackgroundOpacity="1.000" LocalTooltip="Mimimize" Name="Minimize" OnPress="Visible=false Parent.Restore.Visible=true set_focus Parent.Parent.Parent.Parent.Parent.Player.Fullpath" ScrollExtent="13,9" Size="13,9" Style="ShowControl.ButtonDefault"/> <Button BackgroundOpacity="1.000" LocalTooltip="Restore" Name="Restore" OnPress="Visible=false Parent.Minimize.Visible=true set_focus Parent.Parent.Parent.Parent.Parent.Player.Fullpath" ScrollExtent="13,9" Size="13,9" Style="ShowControl.ButtonActivated" Visible="false"/> I have no idea why a Checkbox requires you to press it for a couple tenths of a second and a Button doesn't. What kind of code would cause that? I wish the documentation wasn't so shoddy so I wouldn't have to waste 5 hours trying to figure out each little bug. |
Another option is to give the checkbox control...
onHoverout="set_focus Parent.Parent.Parent.Parent.Parent.Player.Fullpath" |
It seems like the reason a dropdown menu always grabs the spacebar input is that you can use spacebar - arrow keys - enter key to use the dropdown menu without the mouse, but I really doubt many players use that unless some kind of physical disability prevents them from using a mouse at all.
|
I had the same issue with the way I did show head armor. I just simply enabled and !enabled the dropdown with the OnHoverIn & OnHOverOut event of said window.
|
Quote:
|
If by first level you mean the root node of that window then yes. Hmm if the browser object is causeing the OnHoverOut to fire then yea that way wouldn't work. But I kind of think that is a bug because OnHoverOut shouldn't fire until the mouse left that node.
|
All times are GMT -5. The time now is 05:30 PM. |
vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI