Some TextBox Fixes


04-03-2008 07:14:58

Hey All,

I spent a little time fixing some TextBox issues that seemed a little annoying. For example, if you click and drag to select text, but then release the mouse button outside of the textbox, the text would no longer be selected. Also, if you were selecting text and your cursor went above or below the textbox itself, the selection wouldn't follow your current x position. These are two differences from the textboxes we are familiar with.

Anyway, here's a patch for my fixes, so you can look over my changes:



04-03-2008 18:17:52

Awesome, I'll look over this tonight! Thanks for helping out with the TextBox. :)


05-03-2008 19:10:02

I looked over the patch, and I'm not sure about the following code:

// If the MouseButton was not pressed on this widget, do not register the button being released on the widget
if( mWidgetContainingMouse != mActiveWidget )
// If it is a textbox, don't lose focus, just fire a mouse button up event
if( mActiveWidget->getWidgetType() == Widget::TYPE_TEXTBOX )
return mActiveWidget->fireEvent(Widget::EVENT_MOUSE_BUTTON_UP,args);
return mActiveWidget->fireEvent(Widget::EVENT_LOSE_FOCUS,args);

It seems very hard coded, there needs to be a more elegant solution to this. I'll have to look at it more in depth, but I'm hesitant to apply the patch as is.


07-03-2008 07:06:09

Yeah, I was a little concerned about that too... but as structured, it seemed to be the only place where the lose focus event was being called and could be substituted to something else.

It would be nice to abstract it out though.


07-03-2008 17:36:45

I went ahead and applied the patch. We can always change it later if we think of a better idea. :)