Page 1 of 1

Height of the text area of the Combobox

Posted: Thu Oct 19, 2006 04:21
by Gaal
Why the height of the text area of the Editbox of the Combobox is dependent of the height of the Default Font instead of the Font defined in the Combobox in the layout file ?

The font seem ok, but not the height of text area !

Posted: Thu Oct 19, 2006 08:29
by CrazyEddie
Which version of the library?
Which look are you using?
Are other looks affected?

Posted: Thu Oct 19, 2006 09:09
by Gaal
Bonjour Eddie

Oups :oops: I forgot the essential!

Which version of the library? Last released one 0.5RC2
Which look are you using? the one given with (Taharez)
Are other looks affected? I focused only on Combo.

I had a very quick look at CeGUI::Combobox early this morning, and I noticed that in one of the first called method there is the initialisation of EditBox->setFont(getFont()) which initialise with the DefaultFont. (I don't remember the name of the method and I have not the source here, I'm at work!)
It might be a bit early to initialise the Font, but I did not have enough time to search more deeply inside the code.
I will let you look for it...

Posted: Fri Oct 20, 2006 08:29
by CrazyEddie
Thanks for the additional info :)

I looked briefly at some code yesterday and it appears that it should be working, but apparently it's not. I'll do some proper tests and hopefully get it fixed.

Having just written that, I actually have a strong suspicion that this could be a similar situation to something else that came up earlier in the week. Hmmmm. Very interesting :twisted:

CE.

Posted: Fri Oct 20, 2006 10:09
by CrazyEddie
I have now tested this, and can report that it's working as expected - the Editbox portion of the Combobox is sized correctly according to the font specified in a layout file.

So, you need to post the layout file, CEGUI.log, also which font are you using and which glyphs are being rendered. Any chance of a couple of screen shots?

Posted: Fri Oct 20, 2006 16:55
by Gaal
Bonsoir Eddie,
Here are some results of the test I've performed.
First let me tell you the scheme:

Code: Select all

File : "GenesiaLookSkin.scheme.xml"
<?xml version="1.0" ?>
<GUIScheme Name="GenesiaLookSkin">
   <Imageset Name="GenesiaLook" Filename="GenesiaLook.imageset.xml" />
   <Font Name="genesia-12"      Filename="genesia-12.font.xml" />
   <Font Name="genesia-8"      Filename="genesia-8.font.xml" />
   <Font Name="genesia-6"      Filename="genesia-6.font.xml" />
   <LookNFeel Filename="GenesiaLook.looknfeel.xml" />
   <LookNFeel Filename="StaticPlainImage.looknfeel.xml" />
   <LookNFeel Filename="ComboBoxSmall.looknfeel.xml" />
   <LookNFeel Filename="RadioPushButton.looknfeel.xml" />
   <WindowRendererSet Filename="CEGUIFalagardWRBase" />
   <FalagardMapping WindowType="GenesiaLook/Button"      TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="GenesiaLook/Button" />
- - - - - - - - - - - -
   <!-- Quelques widgets spĂ©ciaux pour Genesia -->
   <FalagardMapping WindowType="GenesiaLook/StaticPlainImage"      TargetType="DefaultWindow"         Renderer="Falagard/StaticImage"   

   LookNFeel="GenesiaLook/StaticPlainImage" />
   <FalagardMapping WindowType="GenesiaLook/ComboSmallDropList"   TargetType="CEGUI/ComboDropList"   Renderer="Falagard/Listbox"         

LookNFeel="GenesiaLook/ComboSmallDropList" />
   <FalagardMapping WindowType="GenesiaLook/ComboBoxSmall"         TargetType="CEGUI/Combobox"         

Renderer="Falagard/Default"         LookNFeel="GenesiaLook/ComboBoxSmall" />
   <FalagardMapping WindowType="GenesiaLook/RadioPushButton"      TargetType="CEGUI/RadioButton"      Renderer="Falagard/ToggleButton"   

LookNFeel="GenesiaLook/RadioPushButton" />
</GUIScheme>


Then an example of a font file: there three files with respectively size of 6, 8 and 12

Code: Select all

?xml version="1.0" ?>
<Font Name="genesia-6"
         Filename="genesia.ttf"
         Type="FreeType"
         Size="6"
         NativeHorzRes="800"
         NativeVertRes="600"
         AutoScaled="true"
         AntiAlias="true"
/>

Then here are the code of the initialisation of CeGUI system:

Code: Select all

   // CeGUI Initialisation
   mGUI = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 0);
   mGUISystem = new CEGUI::System(mGUI);
   CEGUI::SchemeManager::getSingleton().loadScheme("GenesiaLookSkin.scheme.xml");
   mGUISystem->setDefaultMouseCursor("GenesiaLook", "MouseArrow");
   
   // Change the following with genesia-6 and genesia-8
   mGUISystem->setDefaultFont("genesia-12");
   
   mRootGuiSheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultGUISheet", "root");
   mGUISystem->setGUISheet(mRootGuiSheet);


   CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
   CEGUI::Window *st, *win;

    mGuiSheet = CEGUI::WindowManager::getSingleton().loadWindowLayout("TestFrench.xml");
   Global::mKernel->getGUISystem()->getGUISheet()->addChildWindow(mGuiSheet);

   win = wmgr.getWindow((CEGUI::utf8*)"Test/Window");
   st = wmgr.getWindow((CEGUI::utf8*)"FontDefaut");
   st->setText("Default font =" + win->getFont()->getProperty("Name"));



And the sherry on top of the cake, here are the three screen shots:
Image
Image
Image

So as you can notice, the height of the coimbo is dependent of the Defaut Font size! and not the EditBox
You may find all other files here
I made the font TTF myself.
For the moment the look is like taharez, I'm waiting for "time" to make my own skin :lol:

Posted: Sat Oct 21, 2006 08:36
by CrazyEddie
Ok, thanks for all the extra info and the screenies; I will have another look and try to recreate the issue. Hopefully I will have some news later on today...

Posted: Sat Oct 21, 2006 20:15
by Gaal
In my point of view, I think that there is something inconsistent with Combo with regard to other widgets: it is the definition of the size.

Indeed, the height we give in the layout for the Combo is used for the height of the DropdownList.
I think it should have been used for the height of the Editbox instead.

And there should have been a Property such as "DropdownListHeight" which could define the Dropdownlist. This latter could also have a default value dependent of the font size such as "three ListItem".

It is just an idea...

Posted: Sat Oct 21, 2006 21:51
by CrazyEddie
Hi,

I can confirm that the issue you are seeing here is indeed the result of a bug in the system - nothing to do with Combobox directly, but rather a side effect of something I failed to consider for part of the skinning system. (The usage of FontDim in the skin definition; this behaves properly in itself, but no call is made to Window::performChildWindowLayout when the font is later changed - thus causing the size of the component widget that relies on the font not to update).

For yourself, looking for an immediate fix or workaround, I suggest subscribing to the event Window::EventFontChanged and calling performChildWindowLayout yourself. You could do this on the global event set and just have it called for all windows - since fonts usually get changed rarely, the performance hit will be negligible.

For me, looking for a permanent and 'correct' fix, there are some other alternatives to consider ;)

Anyway, thanks for this, the actual bug is something that could not have surfaced much at all, but has potential to be a major PITA depending on how people are using the skinning system, at least now we can fix it in time for 0.5.0 final :D

CE.

Posted: Sun Oct 22, 2006 07:14
by Gaal
Ok, thanks for that, but I've already done my own workaround.

Then what about the idea for the Combo widget to have the unifiedsize property dedicated for the Editbox and another property to define the height of the droplist ? This height could be given either in pixel or in a number of items we would want to see in the list (before scrollbar is visible).

in this way all widgets will be consistent as far as unifiedsize is concerned. It applies for the visible part of the widget, and it is used to set the widget on the sheet.

Posted: Sun Oct 22, 2006 17:00
by CrazyEddie
That is the "other" main design for a combo box. Now we have what we have it's not likely to change - especially since we intend to replace this one with something better.

The current Combobox is probably the widget that people hate the most for one reason or another :)

Lindquist is/will be doing new versions of the list type widgets, and has free rein on how he goes about it. Whether a change such as you suggest is in the works for that, I do not know.

CE.

Posted: Sun Oct 22, 2006 19:57
by Gaal
I do not hate this Combobox, it is useful to make a choice among a list.
I agree that this one is already working as is depite some strange behaviours.

My proposition was only a consistency matter and if you have a chance to make some changes, it might be interesting to think about.

I must admit that all you have already done, I mean all this CeGUI system, is wonderful and very useful.

Congratulations...

Posted: Mon Oct 23, 2006 00:07
by lindquist
Getting rid of the area-includes-droplist feature is something I would very much like to do. There are a lot of clipping/picking hacks in the library just to make that work! but... I wont be doing this for a while yet, as my life has turned out quite busy and will stay so for some months.

dont let that keep you from posting valuable constructive feedback on how we can improve it though :)