MenuButtons don't show up (FengGUI)

hey there,



I have  a small game in which I use GameStates and a FengGUI-Menu.

When pressing ESC in the InGameState, I switch to MenuState.

While everything in the InGameState is drawn properly,

the Menu lacks its buttons and the functions bound to them.

Maybe someone could help me there?



the “menu” now looks like this:





my code looks the following:



import java.io.IOException;

import org.fenggui.Button;
import org.fenggui.Container;
import org.fenggui.Display;
import org.fenggui.background.PlainBackground;
import org.fenggui.composites.MessageWindow;
import org.fenggui.event.ButtonPressedEvent;
import org.fenggui.event.IButtonPressedListener;
import org.fenggui.event.mouse.IMousePressedListener;
import org.fenggui.event.mouse.IMouseReleasedListener;
import org.fenggui.event.mouse.MousePressedEvent;
import org.fenggui.event.mouse.MouseReleasedEvent;
import org.fenggui.layout.Alignment;
import org.fenggui.layout.RowLayout;
import org.fenggui.layout.StaticLayout;
import org.fenggui.render.Binding;
import org.fenggui.render.Pixmap;
import org.fenggui.util.Color;
import org.fenggui.util.Spacing;

import com.jme.input.AbsoluteMouse;
import com.jme.input.Mouse;
import com.jme.input.MouseInput;
import com.jme.math.Vector3f;
import com.jme.renderer.Renderer;
import com.jme.scene.SceneElement;
import com.jme.scene.state.LightState;
import com.jme.system.DisplaySystem;
import com.jmex.game.state.CameraGameState;
import com.jmex.game.state.GameState;
import com.jmex.game.state.GameStateManager;

public class MyMainMenuState extends CameraGameState implements IMouseReleasedListener, IMousePressedListener{
   
   private Game parent;
   private DisplaySystem menuDisplay;
   private final Container menuContainer;
   private Mouse menuMouse;//used in initInput()
   private org.fenggui.Display menuFengguiDisplay;
   private FengJMEInputHandler mainMenuInputHandler;
   private GameMenuButton newGame, backToGame, options, credits, quit;
   private GameMenuButton sound, graphics, back, network;
   private org.fenggui.Display dispToDetachWidgetsFrom;
   

   public MyMainMenuState(String name, Game parent) {
      super(name);
      
      this.parent=parent;
      
      cam.setLocation(new Vector3f(0,0,20));
      cam.setDirection(new Vector3f(0,0,-20));
      cam.update();
      
      MouseInput.get().setCursorVisible(true);
      menuDisplay=DisplaySystem.getDisplaySystem();
      menuDisplay.getRenderer().setBackgroundColor(ColorRGBA.orange);
      menuContainer=new Container();

      initInput();

      rootNode.setLightCombineMode(LightState.OFF);
      rootNode.setRenderQueueMode(Renderer.QUEUE_ORTHO);
      rootNode.setCullMode(SceneElement.CULL_NEVER);
              rootNode.updateRenderState();
              rootNode.updateGeometricState(0, true);      
   }
   
   private void initInput(){
      menuMouse=new AbsoluteMouse(
            "menuMouse", menuDisplay.getWidth(), menuDisplay.getHeight());
   }
   
   public void onActivate() {   
      menuDisplay.setTitle("House Of Bubbles Menu");
      parent.getGameInputHandler().setEnabled(false);
      buildMainMenu();
      super.onActivate();
   }
   
   public void onDeactivate() {
      mainMenuInputHandler.setEnabled(false);
      parent.getGameInputHandler().setEnabled(true);
      super.onDeactivate();
   }
   
   private void buildMainMenu(){
      menuFengguiDisplay=parent.getGameFengguiDisplay();
      menuFengguiDisplay.addWidget(menuContainer);
      
      menuContainer.getAppearance().add(new PlainBackground(Color.BLACK_HALF_OPAQUE));
      menuContainer.getAppearance().setPadding(new Spacing(10, 10));
   
      menuContainer.setLayoutManager(new RowLayout(false));
      
      mainMenuInputHandler=new FengJMEInputHandler(menuFengguiDisplay);
      mainMenuInputHandler.setEnabled(true);

      initMenuButtons(menuContainer, menuFengguiDisplay);
      buildMainMenuGUI(menuContainer, menuFengguiDisplay);
   }
   
   private void initMenuButtons(
         final Container menuContainer, final Display menuFengguiDisplay){
      
       newGame = new GameMenuButton("data/images/play0.png","data/images/play1.png");
      backToGame = new GameMenuButton("data/images/btg0.png","data/images/btg1.png");
      options = new GameMenuButton("data/images/options0.png", "data/images/options1.png");
      credits = new GameMenuButton("data/images/credits0.png", "data/images/credits1.png");
      quit = new GameMenuButton("data/images/quit0.png", "data/images/quit1.png");
      
      sound = new GameMenuButton("data/images/sound0.png", "data/images/sound1.png");
      graphics = new GameMenuButton("data/images/graphics0.png", "data/images/graphics1.png");
      back = new GameMenuButton("data/images/back0.png", "data/images/back1.png");
      network = new GameMenuButton("data/images/network0.png", "data/images/network1.png");
      
      newGame.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            // TODO create newGame, for now: just go back to game
            GameStateManager.getInstance().deactivateChildNamed("mainMenu");
            dispToDetachWidgetsFrom = parent.getGameFengguiDisplay();
            dispToDetachWidgetsFrom.removeAllWidgets();
            GameStateManager.getInstance().activateChildNamed("inGame");
         }         
      });
      
      backToGame.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            GameStateManager.getInstance().deactivateChildNamed("mainMenu");
            dispToDetachWidgetsFrom = parent.getGameFengguiDisplay();
            dispToDetachWidgetsFrom.removeAllWidgets();
            GameStateManager.getInstance().activateChildNamed("inGame");
         }
      });
      
      options.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            buildOptionsMenu(menuContainer, menuFengguiDisplay);            
         }
      });
      
      credits.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            MessageWindow mw = new MessageWindow("Thank you momie :)");
            mw.pack();
            menuFengguiDisplay.addWidget(mw);
            StaticLayout.center(mw, menuFengguiDisplay);
         }
      });
      quit.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            System.out.println("game end");
            Game.exit();            
         }
         
      });
      back.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            buildMainMenuGUI(menuContainer, menuFengguiDisplay);
         }
      });
   }
   
   private void buildMainMenuGUI(
         final Container menuContainer, final Display menuFengguiDisplay){
      menuContainer.removeAllWidgets();
      menuContainer.addWidget(newGame);
      menuContainer.addWidget(backToGame);
      menuContainer.addWidget(options);
      menuContainer.addWidget(credits);
      menuContainer.addWidget(quit);
      menuContainer.pack();
      StaticLayout.center(menuContainer, menuFengguiDisplay);
   }
   
   private void buildOptionsMenu(
         final Container menuContainer, final Display menuFengguiDisplay){
      menuContainer.removeAllWidgets();
      menuContainer.addWidget(sound);
      menuContainer.addWidget(graphics);
      menuContainer.addWidget(network);
      menuContainer.addWidget(back);
      menuContainer.pack();
      StaticLayout.center(menuContainer, menuFengguiDisplay);
   }
   
   class GameMenuButton extends Button{
      
      String s = null;
      String h = null;
      
      public GameMenuButton(String lowlightFile, String highlightFile){
         super();
         s = lowlightFile;
         h=highlightFile;
         
         try{
            Pixmap lowlight = new Pixmap(Binding.getInstance().getTexture(lowlightFile));
            System.out.println("pix are at" + lowlightFile);
            setPixmap(lowlight);//getDefaultState().setPixmap(lowlight);
            getAppearance().setAlignment(Alignment.MIDDLE);
            getAppearance().apply(this);
         } catch (IOException e){
            e.printStackTrace();
            }
      }
      
      
      public String getGameMenuButtonHighlightfile(){
         return h;
      }
      public String getGameMenuButtonLowlightfile(){
         return s;
      }
   }

   protected void stateUpdate(float tpf) {
      rootNode.updateGeometricState(tpf, true);
      menuFengguiDisplay.display();
   }
   
   public void mouseReleased(MouseReleasedEvent mouseReleasedEvent) {
        GameMenuButton sourceButton=null;
        try {
            sourceButton=(GameMenuButton) mouseReleasedEvent.getSource();
            sourceButton.setPixmap(
                  new Pixmap(Binding.getInstance().getTexture(
                        sourceButton.getGameMenuButtonLowlightfile())));

        }catch(Exception e){
               // TODO: handle exception
           }
    }

    public void mousePressed(MousePressedEvent mousePressedEvent) {
        GameMenuButton sourceButton=null;
        try{
           sourceButton=(GameMenuButton) mousePressedEvent.getSource();
       sourceButton.setPixmap(
                 new Pixmap(Binding.getInstance().getTexture(
                       sourceButton.getGameMenuButtonHighlightfile())));

        }catch (Exception e) {
           // TODO: handle exception
           }
    }

}

Hi!



Without having digged too much in your code yet but judging from your description I suppose that the problem lays in the way you handle the org.fenggui.Display instances. I see from your code, that you have two Dsiplay instances: menuFengguiDisplay and dispToDetachWidgetsFrom. I assume that you use the first in the normal game state (which one works fine) and the latter in the menu state (where the menus are not shown).



Having two Display instances in FengGUI is no problem, as long as you


  • call the display() method for rendering of the right Display instance in the associcated game state,

  • make sure that the Display instance has the right size (you can use Display.setSize() manually as a fail safe way, usually it should set automatically via the Binding) and

  • have a JMeInputHandler for each Display instance so that the input events from jME are forwarded to the currently active display instance.



I am not sure about the last point though.. :) Whackjack, are the difficulties to expect when using several JMeInputHandlers (one for each Display instance)?

But generally I recommend to use only one Display instance throughout your entire application, because this will simplify things a bit. This may already solve the problem and does usually not make much more effort.

I hope this helps?

Cheers!

Johannes

thx for you answer :slight_smile:



I now use only one FengGUI-display in the game

which holds the menu if opened… but still those buttons don't show.



I looked for mistakes in the GameMenuButtons-class but was unable to find any.



Then I checked the stateUpdate-method…

Out of curiosity I removed menuFengguiDisplay.display(); and faced no changes

(menu (black half-opaque thingy) still displayed and button-less).

So display() in the stateUpdate-method of the MenuState was redundant/misplaced I assume?



Placing display() in the stateRender-method instead makes no difference…



I also thought about using another type of GameState

to have more/explicit control over the MenuState's rendering (and updating)

and put the display() in there. Might this help…?



I also wonder if display() in the render-method of the game interferes

with the MenuState's render-method?







Sk

There seems to be a problem concerning the Display's size (vs button's/pixmap's size)…

Chose a bigger display in the properties dialogue and there they were… those buttones

much ado about… well… almost nothing… ://

adapting button/pixmap-size… hope to succeed…



add: changed the GameMenuButton according to the example in org.fenggui.example.GameMenuExample

now I even got those mouse overs working…

but it all still lacks the functions on the buttons…

Hi Neebie!



I am not sure if I get your right in your last post. Did you manage to display the buttons?


but it all still lacks the functions on the buttons..


Do you mean that clicking on one of the buttons has no effect? have you registered an ButtonPressedListener?

Johannes

yes, I got the buttons displayed now, but clicking on them has no effect…



This is what I do:



I create the GameStates (InGameState, MenuState) and the FengGUI-display in the game-class.

In the game-class I also assign a FengJmeInputHandler to this display…



My Game starts in the MenuState.

There I use

menuFengguiDisplay=parent.getGameFengguiDisplay();

to get me that display and show my menu…

This being no new instance I didn't assign a FengJmeInputHandler to menuFengguiDisplay because

that was already done in the game-class…



Maybe that's where I make a mistake…?







Here is the new code:

public class MyMainMenuState extends CameraGameState{
   
   private Game parent;
   private Node scene;
   private DisplaySystem menuDisplay;
   private Mouse menuMouse;//used in initInput()
   private org.fenggui.Display menuFengguiDisplay;
   private GameMenuButton newGame, backToGame, options, credits, quit;
   private GameMenuButton sound, graphics, back, network;
   

   public MyMainMenuState(String name, Game parent) {
      super(name);
      
      this.parent=parent;
      
      cam.setLocation(new Vector3f(0,0,20));
      cam.setDirection(new Vector3f(0,0,-20));
      cam.update();
      
      ZBufferState zbuf = parent.getGameDisplay().getRenderer().
      createZBufferState();
      zbuf.setEnabled(true);
      zbuf.setFunction(ZBufferState.CF_LESS);
      scene = this.getRootNode();
      scene.setRenderState(zbuf);
      
      MouseInput.get().setCursorVisible(true);
      
                menuDisplay=DisplaySystem.getDisplaySystem();
      menuDisplay.getRenderer().setBackgroundColor(ColorRGBA.orange);

      initInput();

      
           rootNode.setLightCombineMode(LightState.OFF);
                rootNode.setRenderQueueMode(Renderer.QUEUE_ORTHO);
           rootNode.setCullMode(SceneElement.CULL_NEVER);
           rootNode.updateRenderState();
           rootNode.updateGeometricState(0, true);
       
      buildMainMenuGUI();   
   }
   
   private void initInput(){
      menuMouse=new AbsoluteMouse("menuMouse", menuDisplay.getWidth(), menuDisplay.getHeight());
   }

   private void buildMainMenuGUI(){
      menuFengguiDisplay=parent.getGameFengguiDisplay();
      
      final Container menuContainer=new Container();
      menuContainer.getAppearance().add(new PlainBackground(Color.BLACK_HALF_OPAQUE));
      
      menuFengguiDisplay.addWidget(menuContainer);

      menuContainer.getAppearance().setPadding(new Spacing(10, 10));
      menuContainer.setLayoutManager(new RowLayout(false));
      
      
      initMenuButtons(menuContainer, menuFengguiDisplay);
      buildMainMenu(menuContainer, menuFengguiDisplay);
   }
   
   private void initMenuButtons(final Container menuContainer, final Display menuFengguiDisplay){
      
       newGame = new GameMenuButton("newGame","data/images/play0_new.png","data/images/play1_new.png");
      backToGame = new GameMenuButton("backToGame", "data/images/btg0_new.png","data/images/btg1_new.png");
      options = new GameMenuButton("options","data/images/options0_new.png", "data/images/options1_new.png");
      credits = new GameMenuButton("credits","data/images/credits0_new.png", "data/images/credits1_new.png");
      quit = new GameMenuButton("quit","data/images/quit0_new.png", "data/images/quit1_new.png");
      
      sound = new GameMenuButton("sound","data/images/sound0_new.png", "data/images/sound1.png");
      graphics = new GameMenuButton("graphics","data/images/graphics0_new.png", "data/images/graphics1.png");
      back = new GameMenuButton("back","data/images/back0_new.png", "data/images/back1.png");
      network = new GameMenuButton("network","data/images/network0_new.png", "data/images/network1.png");
      
      newGame.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            GameStateManager.getInstance().deactivateChildNamed("mainMenu");
            menuFengguiDisplay.removeAllWidgets();
            GameStateManager.getInstance().activateChildNamed("inGame");
         }         
      });
      
      backToGame.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            GameStateManager.getInstance().deactivateChildNamed("mainMenu");
            menuFengguiDisplay.removeAllWidgets();
            GameStateManager.getInstance().activateChildNamed("inGame");
         }
      });
      
      options.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            buildOptionsMenu(menuContainer, menuFengguiDisplay);            
         }
      });
      
      credits.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            MessageWindow mw = new MessageWindow("Thank you momie :)");
            mw.pack();
            menuFengguiDisplay.addWidget(mw);
            StaticLayout.center(mw, menuFengguiDisplay);
         }
      });
      quit.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            //disp.removeWidget(c);
            System.out.println("game end");
            Game.exit();            
         }
         
      });
      back.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            buildMainMenu(menuContainer, menuFengguiDisplay);
         }
      });
   }
   
   private void buildMainMenu(final Container menuContainer, final Display menuFengguiDisplay){
      
      menuContainer.removeAllWidgets();
      menuContainer.addWidget(newGame);
      menuContainer.addWidget(backToGame);
      menuContainer.addWidget(options);
      menuContainer.addWidget(credits);
      menuContainer.addWidget(quit);
      menuContainer.pack();
      StaticLayout.center(menuContainer, menuFengguiDisplay);
   }
   
   private void buildOptionsMenu(final Container menuContainer, final Display menuFengguiDisplay){
      menuContainer.removeAllWidgets();
      menuContainer.addWidget(sound);
      menuContainer.addWidget(graphics);
      menuContainer.addWidget(network);
      menuContainer.addWidget(back);
      menuContainer.pack();
      StaticLayout.center(menuContainer, menuFengguiDisplay);
   }
   
   class GameMenuButton extends Button{
      
      String n = null;
      String s = null;
      String h = null;
      
      public GameMenuButton(String name, String lowlightFile, String highlightFile){
                  
         getAppearance().removeAll();
         
         n=name;
         s = lowlightFile;
         h=highlightFile;

         try{
            Pixmap lowlight = new Pixmap(Binding.getInstance().getTexture(lowlightFile));
            Pixmap highlight = new Pixmap(Binding.getInstance().getTexture(highlightFile));
            
            getAppearance().add(new SetPixmapSwitch(Button.LABEL_DEFAULT, this, lowlight));
            getAppearance().add(new SetPixmapSwitch(Button.LABEL_MOUSEHOVER, this, highlight));
            getAppearance().add(new SetPixmapSwitch(Button.LABEL_FOCUSED, this, highlight));
            
            getAppearance().setEnabled(Button.LABEL_DEFAULT, true);
            getAppearance().setAlignment(Alignment.MIDDLE);            
         } catch (IOException e){
            e.printStackTrace();
            }         
      }
   
      public String getMenuButtonName(){
         return n;
      }
      public String getGameMenuButtonHighlightfile(){
         return h;
      }
      public String getGameMenuButtonLowlightfile(){
         return s;
      }
   }
   
   protected void stateUpdate(float tpf) {
      rootNode.updateGeometricState(tpf, true);
   }
   protected void stateRender(float tpf){
      menuFengguiDisplay.display();
   }
   
   public void onActivate() {   
      menuDisplay.setTitle("House Of Bubbles Menu");
      super.onActivate();
   }
   
   public void onDeactivate() {
      super.onDeactivate();
   }
   
}

Hi Neebie!



I am glad to hear that the buttons are eventually rendered. I noticed you make use of the PixmapSwitches which is great because I added this whole appearance/switch/label concept only two weeks ago. If you continue like that you will become a FengGUI pro soon :slight_smile:



As for your input issue, the problem is that the input events are not forwarded from jME to FengGUI. So every time you switch to another display you need to tell the FengJMEInputHandler that you are using another display now. So what I suggest is that you modify your local copy of FengJMEInputHandler such that you add a setDisplay(org.fenggui.Display disp) method that sets the private member disp. Every time you switch the display, you pass the current display to the FengJMEInputHandler via your own setDisplay method.



I believe this should do the trick. Please let me know whether I am right :slight_smile:



Johannes

Hi Johannes,



The FengJMEInputHandler seems to work just fine

(gives me feedback when mouse is pressed in the menu/menuState)

(I don't even have to tell the FengJMEInputHandler about a change of displays

'cause there is only one and no switching… ?)



It's rather like this, that the IButtonPressedListener seems to do nothing…



For example:


newGame.addButtonPressedListener(new IButtonPressedListener(){

         public void buttonPressed(ButtonPressedEvent e) {
            System.out.println("newGame button pressed");
            GameStateManager.getInstance().deactivateChildNamed("mainMenu");
            menuFengguiDisplay.removeAllWidgets();
            GameStateManager.getInstance().activateChildNamed("inGame");
         }         
      });



never even gets to the line

System.out.println("newGame button pressed");


(I never receive any output)

Oh my god! You are right: http://fenggui.svn.sourceforge.net/viewvc/fenggui/src/org/fenggui/Button.java?view=markup in line 135! I fix that as soon as I am back from work.



As a work-around, add an IMousePressedListener.



Johannes

Hi Neebie!



I just checked the sources again and I think Button is okay despite me former panic. The reason why I first thought that it contains a bug was that I expected the mouse-pressed event handling routine to fire the ButtonPressedEvent. But FengGUI does not fire the button when it gets down, but rather when it gets up again, because the user may want to drag the cursor from the button and realease somewhere else to cancel the button click (this is common behavior. Try it out on windows: press a button in some frame but dont release the mouse button unless you dragged it off the button. Then release and you will notice that the button will not be pressed).



Anyway, the yadda-yadda does not solve your problem…  :slight_smile:



I admit that I am running a bit out of ideas what may cause this problem…



Is the IMousePressedListener firering on mouse clicks? Does IMouseEnteredListener, IMouseExitedListener work as expected? (I guess so because you mentioned that the switches work…). Are you sure that you add your IButtonPressedListener implementation to the Button instance that is actually pressed?



Oh, have you tried to open a Window on your display? For example, try


        // create a simple dialog
       Window window = new Window(true, false, false);
       display.addWidget(window);
       // position the dialog. Keep in mind that FengGUI has the origin
       // in the lower left corner!
       window.setX(100);
       window.setY(50);
       
       // set the size of the dialog to 200, 100
       window.setSize(200, 100);
       window.setTitle("FengGUI says...");
       
       // create a label inside the Windows content container
       Label label = new Label("Hello World!");
       label.getAppearance().setAlignment(Alignment.MIDDLE);
       window.getContentContainer().addWidget(label);
       
       // recursively layout the whole GUI
       window.layout();



When you see the window, click on the "close" button in the upper right corner and check if the window vanishes. If it does the button should work fine in principle.

Please let me know if this helps or if you made some progress. This problem really caught my curiosity.  :)

Johannes

Hej Johannes,





IMouseEnteredListener and IMouseExitedListener should work, because as you said the PixmapSwitch works…

(I must admit that -because the switching makes no problem- I didn't have a closer look at those Listeners)



I did notice something strange elsewhere:

When I add a MousePressedListener to a button, it fires a MousePressedEvent when I press the mouse on that button

(who would have thought :wink: )

but when i release the mouse while it's still on the same button…it fires a MousePressedEvent again and no MouseReleasedEvent…

(never receive a "Mouse Released, Ma'am")



Here a code-example:


public class MyMainMenuState
      extends CameraGameState
      implements IMouseReleasedListener, ImousePressedListener{
                      ...
                      private void initMenuButtons(final Container menuContainer, final Display menuFengguiDisplay){
      
                         newGame = new GameMenuButton("newGame","data/images/play0_new.png","data/images/play1_new.png");

                                newGame.addButtonPressedListener(new IButtonPressedListener(){

                                 public void buttonPressed(ButtonPressedEvent e) {
                                   System.out.println("newGame button pressed");   
                                                        GameStateManager.getInstance().deactivateChildNamed("mainMenu");
                                    menuFengguiDisplay.removeAllWidgets();
                                      GameStateManager.getInstance().activateChildNamed("inGame");
                                        }         
                       });
      
                      newGame.addMousePressedListener(this);
                      newGame.addMouseReleasedListener(this);
                                ...
                       }
                       ...
                      public void mousePressed(MousePressedEvent mousePressedEvent) {
                                  System.out.println("Mouse Pressed, Ma'am");
                      }

                 public void mousePressed(MousePressedEvent mousePressedEvent) {
                               System.out.println("Mouse Pressed, Ma'am");
                 }
}




oh and I tried the thing with the window but it didn't react to clicking the close-button

Do I misunderstand and/ or overlook a very important thing here..
or mabye two.. three..?  :oops:

neebie

Hi Neebie


oh and I tried the thing with the window but it didn't react to clicking the close-button


This is extremely weird! The mouse motion events are passed to the widgets, but the mouse are clicks not.

Do I misunderstand and/ or overlook a very important thing here..
or mabye two.. three..?


I really have no clue what's causing this, but I think that the problem actually lays outside of FengGUI.

I did notice something strange elsewhere:
When I add a MousePressedListener to a button, it fires a MousePressedEvent when I press the mouse on that button
(who would have thought Wink )
but when i release the mouse while it's still on the same button..it fires a MousePressedEvent again and no MouseReleasedEvent..
(never receive a "Mouse Released, Ma'am")


That's again very strange. I just ran the scenario you described and it works perfect for me. This whole thing makes me start to believe that the problem may lay in FengJMEInputHandler. Is there a chance that some other input stuff you are using may interfere with the FengJMEInputHandler? Maybe Whackjack can make an educated guess on that.

Would it be possible if you send me your project and I try to reproduce the problem? That would enable me to run a debug session on it to try to figure out why the mouse clicks dont get through.

Johannes

first of all: huge thanks for all your help and support… and please don't strangle me when I say this now:



good news: problem solved  :slight_smile:

bad news: all my fault and what a lousy one  :oops:



copy-and-paste error in my FengJMEInputHandler

(it can't work when you have stupidly placed a fireMousePressedEvent

where there should be a fireMouseReleasedEvent)

duh…



once again: biiiiig sorry  :expressionless:

Hehe, no problem!  :lol:



I am glad that it all sorted out in the end. I could have come to think of the FengGUIJMEInputHandler earlier myself.



Good luck with your project and please send me a screenshot one day :slight_smile:



Johannes