FengGui Combobox Problem

My Combobox does not react if I click at it, however the button does work as expected O.o

Probably  i just forgot soething, however I can't find what :(, any help would be nice.



package RenderPasses;

import java.io.IOException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;

import org.fenggui.Button;
import org.fenggui.ComboBox;
import org.fenggui.Container;
import org.fenggui.Display;
import org.fenggui.FengGUI;
import org.fenggui.Label;
import org.fenggui.List;
import org.fenggui.ListItem;
import org.fenggui.TextEditor;
import org.fenggui.appearance.LabelAppearance;
import org.fenggui.binding.render.Binding;
import org.fenggui.binding.render.ITexture;
import org.fenggui.binding.render.Pixmap;
import org.fenggui.binding.render.lwjgl.LWJGLBinding;
import org.fenggui.composite.Window;
import org.fenggui.decorator.PixmapDecorator;
import org.fenggui.layout.LayoutManager;
import org.fenggui.layout.StaticLayout;
import org.fenggui.theme.XMLTheme;
import org.fenggui.util.Color;
import org.fenggui.util.Point;
import org.fenggui.util.Spacing;

import GameObjects.ShipParts.BaseShipPart;
import Interface.util.FengJMEInputHandler;
import Interface.util.FengguiUtils;
import RenderPasses.Manager.RenderPassManager;

import com.jme.input.MouseInput;
import com.jme.math.Vector3f;
import com.jme.renderer.Renderer;
import com.jme.renderer.pass.RenderPass;
import com.jme.scene.Node;
import com.jme.scene.shape.Box;
import com.jme.system.DisplaySystem;
import com.jme.util.GameTaskQueueManager;

public class ShipEditor extends RenderPass{
   private Node EditorNode;
   private Display fengguidisplay;
   private FengJMEInputHandler input;
   private int xpercent;
   private int ypercent;
   private ComboBox<Object> shiplist;
   
   public ShipEditor(){
      super();
      xpercent = DisplaySystem.getDisplaySystem().getWidth()/100;
      ypercent = DisplaySystem.getDisplaySystem().getHeight()/100;
      EditorNode = new Node();
      fengguidisplay = new org.fenggui.Display(new org.fenggui.binding.render.lwjgl.LWJGLBinding());
      input = new FengJMEInputHandler(fengguidisplay);
      
      Step1_SelectShip_Create();
      
      
      //BuildControll();
      
      this.setEnabled(true);
      EditorNode.updateRenderState();
      this.add(EditorNode);
   }
   
   private Pixmap loadPixmap(final String filename){
      Callable<Pixmap> call = new Callable<Pixmap>() {
            public Pixmap call() throws Exception {
                Binding.getInstance().setUseClassLoader(true);
                return new Pixmap(Binding.getInstance().getTexture(filename));
            }
        };
         try {
         return GameTaskQueueManager.getManager().render(call).get();
      } catch (InterruptedException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      } catch (ExecutionException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      return null;
   }
   
   private void BuildControll() {
      Container container = FengGUI.createContainer(fengguidisplay);
      PixmapDecorator camback = new PixmapDecorator(Window.GENERATE_NAME,loadPixmap("data/textures/Interface/shipedit-cam-back.png"));
      container.getAppearance().add(camback);
      container.setSize(xpercent * 100,100);
      container.setPosition(new Point(0,0));
      
      PixmapDecorator circle = new PixmapDecorator(Window.GENERATE_NAME,loadPixmap("data/textures/Interface/circlepng.png"));
      
      
   }

   private void Step1_SelectShip_Create() {
      final Container container = FengGUI.createContainer(fengguidisplay);
      PixmapDecorator camback = new PixmapDecorator(Window.GENERATE_NAME,loadPixmap("data/textures/Interface/circlepng.png"));
      container.getAppearance().add(camback);
      container.setSize(xpercent * 40,ypercent * 40);
      container.setPosition(new Point(xpercent*30,ypercent * 30));
      
      Label help = FengGUI.createLabel(container,"Select a ship to EDIT, or create a NEW one",new Color(255, 255, 255, 255));
      FengguiUtils.Center(help, new Point(container.getWidth()/2,container.getHeight()/2));      
      
      
      Button newship = FengGUI.createButton(container,"Create new");
      newship.setSize(xpercent * 20,ypercent * 5);
      newship.setPosition(new Point(xpercent * 10,ypercent * 10));
      
      Callable<ComboBox<Object>> call = new Callable<ComboBox<Object>>() {
            public ComboBox<Object> call() throws Exception {
               return FengGUI.createComboBox(container);
            }
        };
        try {
         shiplist = GameTaskQueueManager.getManager().render(call).get();
      } catch (InterruptedException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      } catch (ExecutionException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      shiplist.setEnabled(true);
      shiplist.getAppearance().add(camback);
      shiplist.setSize(xpercent * 20,20);
      shiplist.setPosition(new Point(xpercent * 10 ,ypercent * 30));
      shiplist.addItem("lol");
      shiplist.addItem("bla1");
      shiplist.addItem("bla2");
      shiplist.addItem("bla3");
      shiplist.addItem("bla4");
      shiplist.addItem("bla5");
      shiplist.addItem("bla6");
      shiplist.addItem("bla7");
      shiplist.addItem("bla8");
   }
   
   
   public void SetUseableParts(BaseShipPart Type,int amount){
      
   }
   
   public void SetAviableShips(String name){
      
   }
   
   public void SetBuyableParts(BaseShipPart Type,int price){
      
   }

   static public String GetName(){
      return "ShipEditor RenderPass";
   }
   
   public void doUpdate(float tpf){
      EditorNode.updateGeometricState(tpf, true);
      input.update(0.01f);
   }
   
   public void setEnabled(boolean status){
      super.setEnabled(status);
      input.setEnabled(status);
      //Disable all ingame states now!
      if(status){

      }
   }
   
   public void doRender(Renderer renderer){
      fengguidisplay.display();
      renderer.draw(EditorNode);
   }
}

I am having the exact same problem.  ComboBox does not drop-down when clicked.  Also, my slider does not show up at all.  :(.  Has anybody found a solution to this?  Maybe it is something in the input handler where the mouse clicks get processed to quickly and cause it to be deselected the next frame?

I got the slider to show up: had to use FengGUI.createSlider and not new Slider(); since only the former uses themes.  I still can't get the ComboBox to drop down though :(.  I manually added fenggui mouse pressed and released listeners to the widgets and verified that a single pressed and released event was generated when I clicked, which was the same behavior observed with the fenggui combo box test example.  So, maybe the popup is not being drawn at all.  I also posted this on the fenggui forums to see if the folks there have any ideas.

I got a solution to this from the fenggui forums. 



Basically, the problem is that the combo box at least as of the revision I am using of fenggui (637) drops-down on a "clicked" event but the JMEInputHandler only fires "pressed" and "released" events, so I modified the FengGUIJMEHandler to also fire clicked events after a pressed->released pair, so now things work like AWT does.



Now the combo boxes work as expected!  Empire Phoenix, if you are still plugging away at FengGUI, I hope this helps.



In the MouseListener, change the onButton method:


        public void onButton(int button, boolean pressed, int x, int y) {
            if (isEnabled() == false) {
                return;
            }
            boolean prevDown = down;
            down = pressed;
            lastButton = button;
            if (pressed)
                mouseHandled = disp.fireMousePressedEvent(x, y,
                        getMouseButton(button), 1);
            else
                mouseHandled = disp.fireMouseReleasedEvent(x, y,
                        getMouseButton(button), 1);
            // fire clicked event if press then released
            if(prevDown && !pressed)
               mouseHandled |= disp.fireMouseClickEvent(x, y, getMouseButton(button), 1);
            // TODO: fire a double-clicked event if two mouse clicks happen in close proximity
        }