make a "zombie widget", bug ?? [REopened]

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

make a "zombie widget", bug ?? [REopened]

Postby Pompei2 » Thu Oct 12, 2006 23:05

Hello.

[edit]found half of the solution. read next post to see the actual problem[/edit]

I got some reasons to use an ImageButton that has some StaticWidget as a child, instead of using a simple PushButton:

Code: Select all

<Window Type="TaharezLook/ImageButton" Name="btnOptions">
   <Property Name="UnifiedPosition" Value="{{1,-280},{1,-290}}" />
   <Property Name="UnifiedSize" Value="{{0,256},{0,50}}" />
   <Property Name="NormalImage"     Value="set:FTSUI image:btnNormal" />
   <Property Name="HoverImage"      Value="set:FTSUI image:btnHover"  />
   <Property Name="PushedImage"     Value="set:FTSUI image:btnPushed" />
   <Property Name="DisabledImage"   Value="set:FTSUI image:btnDisabl" />
   <Window Type="TaharezLook/StaticText" Name="btnOptions_text__">
      <Property Name="UnifiedPosition"   Value="{{0,0},{0,0}}" />
      <Property Name="UnifiedSize"       Value="{{1,0},{1,0}}" />
      <Property Name="FrameEnabled"      Value="False" />
      <Property Name="BackgroundEnabled" Value="False" />
      <Property Name="HorzFormatting"    Value="WordWrapCentred" />
      <Property Name="Text"              Value="Einstellungen" />
   </Window>
</Window>

But now there comes the problem: the static text item "eats" all user input. Is there a possibility to make it bekome a zombie widget, that means a widget that has absolutely no user interaction, so that all user input (mouse hover and click) goes to the ImageButton widget ??
Ok I *could* intercept all user input i want in the code and send it to the ImageButton but it's not the solution i want ... some suggestions ??
Last edited by Pompei2 on Mon Dec 11, 2006 19:33, edited 3 times in total.

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Thu Oct 12, 2006 23:18

damn, shame on me :p I found the property that exactly fits my needs:

Code: Select all

<Property Name="MousePassThroughEnabled" Value="True" />

But now with that option, graphically all looks fine, exept that it doesn't seem to get the mouse click event. I mean the ImageButton doesn't enter my pushed event handler.
Any suggestions ?


[edit]
Ok, I did some debugging and what i found is that it seems this behaivour comes from the function sheet->getChildAtPosition(e.position), called in PushButton::onMouseButtonUp(MouseEventArgs& e) (ceguipushbutton.cpp, line 83), wich seems doesn't care this property.

Code: Select all

void PushButton::onMouseButtonUp(MouseEventArgs& e)
{
   if ((e.button == LeftButton) && isPushed())
   {
      Window* sheet = System::getSingleton().getGUISheet();

      if (sheet)
      {
         // if mouse was released over this widget
         ///////// This condition won't be true, and thus the event handler won't be called ! ///////////
         if ([b]this == sheet->getChildAtPosition(e.position)[/b])
         {
            // fire event
            WindowEventArgs args(this);
            onClicked(args);
         }

      }

      e.handled = true;
   }

   // default handling
   ButtonBase::onMouseButtonUp(e);
}


Is this right ?? If yes, as I don't know that much CEGUI internally, some suggestions for a patch ?? I don't want to do a quick'n'dirty hack :)

good night guys ;)

ps: adding this to the child doesn't seem to change anything:

Code: Select all

<Property Name="DistributeCapturedInputs" Value="True" />

[/edit]

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Sat Oct 14, 2006 12:04

nobody has something to say ??

I got it to work, but I am SURE that my solution is not clean and will break other things, so please, CE or some developper, look into this problem.

in the member

Code: Select all

Window* Window::getChildAtPosition(const Vector2& position) const

in the file ceguiwindow.cpp, i replaced line 716:

Code: Select all

        if ((*child)->isVisible())

by this:

Code: Select all

        if ((*child)->isVisible() && !(*child)->isMousePassThroughEnabled( ) )


for me this works, but as i said, i'm sure this is NOT the ideal and clean solution !

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Sat Oct 14, 2006 19:24

If all you want is a simple label added to the ImageButton then adding a TextComponent in the looknfeel is a much cleaner solution.

MousePassThroughEnabled ensures that mouse input is ignored, so enabling it for a button should indeed disable the button functionality. Why not set it on the StaticText instead? (as that is the widget you dont want to be interactive?) Another option is disabling the static text.

HTH

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Sun Oct 15, 2006 19:51

lindquist wrote:If all you want is a simple label added to the ImageButton then adding a TextComponent in the looknfeel is a much cleaner solution.

I didn't yet really struggle with the Looknfeel files but I will, later :P

lindquist wrote:MousePassThroughEnabled ensures that mouse input is ignored, so enabling it for a button should indeed disable the button functionality. Why not set it on the StaticText instead? (as that is the widget you dont want to be interactive?)

In fact, that is what I did. Sorry if I wasn't clear on this. A button does now look like this:

Code: Select all

<Window Type="TaharezLook/ImageButton" Name="btnOptions">
   <Property Name="UnifiedPosition" Value="{{0.95,-280},{1,-290}}" />
   <Property Name="UnifiedSize" Value="{{0,256},{0,50}}" />
   <Property Name="NormalImage"     Value="set:FTSUI image:btnNormal" />
   <Property Name="HoverImage"      Value="set:FTSUI image:btnHover"  />
   <Property Name="PushedImage"     Value="set:FTSUI image:btnPushed" />
   <Property Name="DisabledImage"   Value="set:FTSUI image:btnDisabl" />
   <Window Type="TaharezLook/StaticText" Name="btnOptions_text__">
      <Property Name="UnifiedPosition"   Value="{{0,0},{0,0}}" />
      <Property Name="UnifiedSize"       Value="{{1,0},{0.9,0}}" />
      <Property Name="FrameEnabled"      Value="False" />
      <Property Name="BackgroundEnabled" Value="False" />
      <Property Name="HorzFormatting"    Value="WordWrapCentred" />
      <Property Name="Text"              Value="Settings" />
      <Property Name="MousePassThroughEnabled"  Value="True" />
      <Property Name="DistributeCapturedInputs" Value="True" />
   </Window>
</Window>

And it doesn't work. That's why I began to think of a bug.

lindquist wrote:Another option is disabling the static text.

Well, ... that works :) thank you !

But I think one should verify if he can reproduce my issue with "MousePassThroughEnabled" and "DistributeCapturedInputs" and see it is a bug ?

Bye

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Thu Dec 07, 2006 13:25

Code: Select all

<Window Type="TaharezLook/ImageButton" Name="btnOptions">
   <Property Name="UnifiedPosition" Value="{{0.95,-280},{1,-290}}" />
   <Property Name="UnifiedSize" Value="{{0,256},{0,50}}" />
   <Property Name="NormalImage"     Value="set:FTSUI image:btnNormal" />
   <Property Name="HoverImage"      Value="set:FTSUI image:btnHover"  />
   <Property Name="PushedImage"     Value="set:FTSUI image:btnPushed" />
   <Property Name="DisabledImage"   Value="set:FTSUI image:btnDisabl" />
   <Window Type="TaharezLook/StaticText" Name="btnOptions_text__">
      <Property Name="UnifiedPosition"   Value="{{0,0},{0,0}}" />
      <Property Name="UnifiedSize"       Value="{{1,0},{0.9,0}}" />
      <Property Name="FrameEnabled"      Value="False" />
      <Property Name="BackgroundEnabled" Value="False" />
      <Property Name="HorzFormatting"    Value="WordWrapCentred" />
      <Property Name="Text"              Value="Settings" />
<!--      <Property Name="Disabled"          Value="True" />-->
<!--      <Property Name="MousePassThroughEnabled"  Value="True" />-->
<!--      <Property Name="DistributeCapturedInputs" Value="True" />-->
   </Window>
</Window>


After my update to final version 0.5 of CEGUI, I lost my change in the CEGUI code (see on my older posts in this thread) and that code doesn't work like before. That means that my problem with the mousse pass trough is NOT SOLVED.
In the code above, I tried all combinations of enabling the three commented lines and NEVER got it to work (that means that the text does ignore any user input and send it to it's parents ...)
I can solve it by editing the CEGUI code, but I don't want it and i think either this is a bug or i am really missing something (strange). Please someone look into that. If this is a bug, my solution is already stated in my post to this thread on "Sat Oct 14, 2006 12:04 pm".


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 15 guests