Open mandrewpowers opened 7 years ago
It's intentional that the F1-F12 keys always run binds regardless of any elements having text focus. Although this only actually happens if the keys are bound to something.
Do you need it to work differently for some reason? I don't think anything is going to change because it seems like a useful feature to always have the bindings run.
@willox I'm writing a text editor (see: http://i.imgur.com/6RG4k7A.png) and the editor is based off TextEntry so that I may catch clipboard pasting. When I started implementing shortcuts such as F5
for compile and execute I realized that it triggered my binds causing menus to popup over my DFrame / editor.
Not that it really matters, but why is this behavior particularly useful? I've never heard of a case where someone has a TextEntry focused and wants to use a function key bind to open something.
tl;dr: More importantly I'd suggest making sure this behavior still triggers GM:PlayerBindPress
so that it can be blocked as needed so this oddness in cases like mine can be avoided.
Side note: The -BIND
is not executed for the function keys in this case, so menus get stuck open such as the scoreboard.
I think its meant for the F10 console default bind.
Also why are you using TextEntry and not RichText? Not saying it will be better with your problem, but it just seems weird to me.
Sorry @robotboy655 I had not been able to work on GMod projects for a while, but anyway...
F10? That use to be disconnect. I thought console was always tilde/grave? Also RichText does not provide anything of use as far as I know. The first time I tried to use it for an editor years ago it was basically just garbage and unnecessarily obnoxious to use from Lua. Writing my own gave me massive control over every aspect in comparison. Why do you think I should use it?
Anymore thoughts on this? Am I just going to have to avoid the function keys? I'd be nice if something like this was more controllable. I still don't feel like some buttons should have weird special handling. They should all act the same.
Would be nice to have this to avoid networking to the client from ShowHelp and ShowTeam for custom functional menus.
Details
Working on a text editor to rule them all and it is based on a TextEntry as to capture pasting. When working on shortcuts I pressed my
+showscores
bind and the scoreboard popped up over my DFrame. ThePlayerBindPress
hook I have is suppose to prevent this (will post hook below). The weird thing I noticed is that when the DFrame is focused the hook isn't called either (this is probably because why would binds be called when vgui has focus). I'm guessing this is a workaround gone wrong, but obviously I have no idea.Hook I use that doesn't get called when my vgui is open:```lua function dgp.PlayerBindPress(ply, bind, pressed) print(ply, bind, pressed) if IsValid(dgp.SuiteFrame) and dgp.SuiteFrame:IsVisible() then dgp.util.log('info', 'dgp.PlayerBindPress: Preventing %s from running while editor open', bind) return true end end hook.Add('PlayerBindPress', 'dgp.PlayerBindPress', dgp.PlayerBindPress)
+showscores
.+showscores
bind and notice nothing happens.+showscores
bind and notice the scoreboard shows (and the hook will print) but does not go away.