Announcement

Collapse
No announcement yet.

Hilighted button in GUI; how to get rid of it?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    generally it isnt a problem. the only time it really stinks is for the mainmenu. for our main menu, i would like to have the buttons all look the same when they first appear. since the first button in the tab order is automatically focused, it will appear focused, which displays the highlighted image.

    perhaps my glitch is the difference between "focused" and "watched." bFocus on watch tells the button to go to its focused state when it becomes watched. so instead of displaying the watched image when the mouse hovers over it, it displays its focused image, which is the intended behavior.

    so actually, the "bug" is my own. i moved the highlighted image to the watched slot, and that produces good results, except for one thing. when the button is focused (either by the initial focus, or by tabbing to it), when the mouse hovers over it, it wont move to its watched state, so the button never highlights.

    i remember i ran into this bug the first time i tried this. maybe im still missing something.

    Comment


      #17
      A hack fix for this is to set tabStop=false in the properties of a button

      Comment


        #18
        true, but that also limits the user to using a mouse to navigate, which is also generally bad GUI design

        tabbing focuses the button, which doesnt highligt it unless you have a highlighted texture for the focused state, which gives you 2 highlighted buttons if you want the mouse to highlight as well, and bFocusOnWatch is false. another undesired effect for my menu.

        Comment


          #19
          Ron, I copied the MenuStateChange event in my button class, and enabled the log message there. What I found is that when a buttons MenuState is MSAT_Focused, it ignores all of the changes to MSAT_Watched. I'm not sure, but I'm pretty sure it should only do that when bFocusOnWatch is TRUE. My buttons have it set to FALSE, but it does it reguardless.

          Comment


            #20
            Originally posted by Bonehed316
            Ron, I copied the MenuStateChange event in my button class, and enabled the log message there. What I found is that when a buttons MenuState is MSAT_Focused, it ignores all of the changes to MSAT_Watched. I'm not sure, but I'm pretty sure it should only do that when bFocusOnWatch is TRUE. My buttons have it set to FALSE, but it does it reguardless.
            Hm, okay - I'll have another look at that code this evening.

            Comment


              #21
              Originally posted by Bonehed316
              Ron, I copied the MenuStateChange event in my button class, and enabled the log message there. What I found is that when a buttons MenuState is MSAT_Focused, it ignores all of the changes to MSAT_Watched. I'm not sure, but I'm pretty sure it should only do that when bFocusOnWatch is TRUE. My buttons have it set to FALSE, but it does it reguardless.
              I don't see anything in GUIComponent.MenuStateChange that could cause the behavior you're seeing. The component's menustate should always be changed to watched, regardless of whether bFocusOnWatch is true or not. When the component receives a call to MenuStateChange with NewState == MSAT_Watched, the component's state is changed to MSAT_Watched. If bFocusOnWatch is true, then the menustate would then immediately be changed to the focused state (though the SetFocus() call). Otherwise the component stays with the watched state. If this isn't working correctly, I don't think the problem is in GUIComponent.MenuStateChange.

              Can you show me the logs that make you think that this is broken?

              Comment


                #22
                Sure Ron.

                I have a subclass of GUIButton which I for our main menu. The only true difference is they use our own styles, and not the Epic ones. I added the following function, which is just a copy from GUIComponent, with the log function enabled.

                Code:
                event MenuStateChange(eMenuState Newstate)
                {
                log("MenuStateChange:"$NewState@Self.Name);
                
                	if ( MenuState != MSAT_Watched )
                		LastMenuState = MenuState;
                
                    bPendingFocus = false;
                	MenuState = NewState;
                    switch (MenuState)
                    {
                        case MSAT_Focused:
                        	if ( !bNeverFocus )
                			{
                				bHasFocus = true;
                	            break;
                	        }
                
                	        MenuState = MSAT_Blurry;
                
                        case MSAT_Blurry:
                            bHasFocus = false;
                            if ( LastMenuState != MSAT_Blurry && LastMenuState != MSAT_Disabled )
                	            OnDeActivate();
                            break;
                
                        case MSAT_Watched:
                            if (bFocusOnWatch)
                            {
                                SetFocus(None);
                                return;
                            }
                
                            OnWatch();
                            break;
                
                        case MSAT_Disabled:
                            if (Controller.ActiveControl == Self)
                                Controller.ActiveControl = None;
                
                            if (Controller.FocusedControl == Self)
                                LoseFocus(None);
                
                            break;
                    }
                
                    if ( FriendlyLabel != None )
                        FriendlyLabel.MenuState = MenuState;
                }

                I compile the code and use the showlog command to watch the log as I move over buttons. I have some of my buttons with bFocusonOnWatch=False, and some with it True to test both situations.

                Hovering over a button with bFocusOnWatch=True I get three log messages at once.

                ScriptLog: MenuStateChange:1 eeButton
                ScriptLog: MenuStateChange:0 eeButton
                ScriptLog: MenuStateChange:2 eeButton

                And hovering over a button with bFocusOnWatch=False I get one, and then another when I move off.

                ScriptLog: MenuStateChange:1 eeButton
                ScriptLog: MenuStateChange:0 eeButton

                However, hovering over a button with bFocusOnWatch=False that is already focused (via tabbing or initial SetFocus) produces no log message, which tells me the MenuState isnt changing. However, the tooltips do show, which means the control is working correctly otherwise.

                Although after looking at it, this may be the intended behavior, as all of the default styles have the watched texture as just a brighter version of the blurry texture, and it might look a bit odd if the button were focused, and went back to watched when the mouse moves over it.

                Comment

                Working...
                X