Menu

#932 [wxSmith] wxFontPickerCtrl has the 'Font' property twice

Undefined
fixed
None
Bug_Report
2020-04-20
2020-03-19
vid
No

Using Code::Blocks with wxSmith, when I click on a wxFontPickerCtrl, I get following assert failure:

./src/propgrid/propgridpagestate.cpp(1693): assert "Assert failure" failed in PrepareToAddItem(): wxPropertyGrid item with name "Font" already exists

Then in the wxFontPickerCtrl properties window, I can see 'Font' property twice. First 'Font' is the very first property in the window, second is between 'BackGround' and 'Tooltip'.

I reproduced this only with an old project I had laying around. I don't remember how I added the wxFontPickerCtrl, and now I can't find it in wxSmith buttons. In the .wxs file it looks like this:
<object variable="font_picker" member="yes" class="wxFontPickerCtrl" name="ID_FONTPICKERCTRL1">
<handler function="OnFontPicker" entry="EVT_FONTPICKER_CHANGED">
</handler></object>

Discussion

  • bluehazzard

    bluehazzard - 2020-04-20
    • status: open --> pending
    • assigned_to: bluehazzard
     
  • bluehazzard

    bluehazzard - 2020-04-20

    I can reproduce this. Will look into it

     
  • bluehazzard

    bluehazzard - 2020-04-20

    Here is a patch.
    This patch probably breaks old wxs files with the font picker in it that uses a predefined font.
    This never should have worked properly, because there are two font sections in the font picker control: One pre selected font and one font for the control.
    In previous versions, both had the same xml tag so it was not possible to differentiate between them... This patch uses now <font_sel> for the preselected font. So the incompatibility with previous versions is simple, that the pre selected font is ignored/not set...</font_sel>

     
  • Teodor Petrov

    Teodor Petrov - 2020-04-20

    How does this look in a xrc file?

     
  • bluehazzard

    bluehazzard - 2020-04-20
    • status: pending --> fixed
     
  • bluehazzard

    bluehazzard - 2020-04-20

    You were right. According https://docs.wxwidgets.org/stable/overview_xrcformat.html#xrc_wxfontpickerctrl the xml property name should be <value>. So this code never worked for xrc files. I use now value for the xrc and wxs name. This will break loading of old files, but as i mentioned top, it never worked the right way (or only random). I think this was a copy and paste error....
    fixed in [r12069]</value>

     

    Related

    Commit: [r12069]


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.