About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Test to see if gui object has focus
Author Message
Axalon Offline
Member

Post: #1
Test to see if gui object has focus
Somewhat simple question, but I'm working on a multiplayer game, and I want to make it so when someone is writing a message in the chatbox your character doesn't continue moving. How can I test to see if the textline has focus (as in, the blinking cursor is there)?
02-03-2010 06:35 AM
Find all posts by this user Quote this message in a reply
Masterxilo Offline
Member

Post: #2
RE: Test to see if gui object has focus
I don't know these by heart (and I can't look them up right now), but there are members of the main "Gui" object that return a pointer to the gui object which has focus (for mouse focus it's Gui.ms).

There might also be a function/member of the gui element (textline) itself that returns if it has keyboard focus.

There might even be a function or something that tells if ANY gui control is active (you wouldn't want to process user input for the game if the user is modifying the gui).

System: Windows 7 Ultimate 64 bit, Q6600 2.4 GHZ, 4GB RAM, nVidia GeForce 260 GTX 896 MB DDR3

Visit my site: hurricane-eye.webs.com
And read my blog: hurricane-eyeent.blogspot.com
02-03-2010 10:45 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Test to see if gui object has focus
you can use Gui.kb, it is set to the gui object with keyobard focus

for example:

if(Gui.kb==&textline)
02-03-2010 03:57 PM
Find all posts by this user Quote this message in a reply
Axalon Offline
Member

Post: #4
RE: Test to see if gui object has focus
(02-03-2010 03:57 PM)Esenthel Wrote:  you can use Gui.kb, it is set to the gui object with keyobard focus

for example:

if(Gui.kb==&textline)

Trying this gives me this error:

error C2446: '==' : no conversion from 'EE::TextLine **' to 'EE::GuiObj *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
error C2040: '==' : 'EE::GuiObj *' differs in levels of indirection from 'EE::TextLine **'

EDIT: I realized that the textline was defined as a pointer, so I just had to change it to

if(Gui.kb==textline)

Problem solved.
(This post was last modified: 02-20-2010 10:12 PM by Axalon.)
02-04-2010 06:16 AM
Find all posts by this user Quote this message in a reply
Post Reply