How do I connect a checkbox and radio buttons to my code?

Hi Ian,

Ok, hope I didn’t confuse anything. I went back and installed wx into /usr/local which appears to be the most customary way. I then deleted my own project dir to start over, and rebooted. Also switched from Haxe 4 rc2 to 4.0.0-rc.3 (I’d accidentally left it at rc.2 after doing some testing with HashLink). Wx is all set:

$ which wx-config
/usr/local/bin/wx-config

$ wx-config --version
3.1.2

and it’s using the libs in /usr/local/lib, and using GTK3 (v3.24.10-1).

All haxelibs fully updated.

So, clean start here.


With a fresh haxeui create hxwidgets skeleton project, here’s some main.xml file contents together with their resulting app screenshots and error messages if present:

<vbox style="padding: 5px;">
    <button text="Click Me!" onclick="this.text='Thanks!'" style="font-size: 24px;" />
</vbox>

haxeui-too-small

No error messages.


<vbox>
    <group id="optionGroup1" layout="horizontal">
        <optionbox id="option1" text="Option 1" selected="true" />
        <optionbox id="option2" text="Option 2" />
        <optionbox id="option3" text="Option 3" />
    </group>
</vbox>

Displays correctly:

Screenshot_2019-08-08_01-58-33

Error/warning message in terminal:

(Main:5733): Gtk-CRITICAL **: 01:56:58.728: gtk_window_resize: assertion 'height > 0' failed

No idea what that’s a line number to. Again, the error/warning doesn’t shutdown the app.


Adding in that padding:

<vbox style="padding: 5px;">
    <group id="optionGroup1" layout="horizontal">
        <optionbox id="option1" text="Option 1" selected="true" />
        <optionbox id="option2" text="Option 2" />
        <optionbox id="option3" text="Option 3" />
    </group>
</vbox>

option-boxes-flat

No error messages this time.


For those option boxes, if I throw in the w/h 100%, it works fine with or without the padding — that is, no error messages.


No error messages for any of the following buttons examples.

Your button examples:

<vbox>
    <button text="Button 1" />
    <button text="Button 2" />
    <button text="Button 3" />
</vbox>

Screenshot_2019-08-07_11-56-37


with the padding

<vbox style="padding: 5px;">
    <button text="Button 1" />
    <button text="Button 2" />
    <button text="Button 3" />
</vbox>

Screenshot_2019-08-08_02-05-14


<vbox>
    <button text="Button 1" />
    <button text="Button 2" height="100"/>
    <button text="Button 3" />
</vbox>

Screenshot_2019-08-07_11-58-01

Sorry, missed that. I don’t know if that’s a line number… You mention Main.cpp … Do you mean the build/hxwidgets/src/Main.cpp? On my system, that file is only 194 lines long. This morning, when I rebuilt and ran the example to get the error, it says:

(Main:1637): Gtk-CRITICAL **: 11:25:36.599: gtk_window_resize: assertion 'height > 0' failed

So, now 1637…

Sorry. Not sure how fruitful this bug report is.

Right, fair enough… so no idea what that means then… was hoping it was a line number…

EDIT: ive ran all the tests above on a debian (non testing) env and all work out just fine… so im running out of ideas… i guess at some point ill need to install debian testing (first time round didnt go so well) and see… your window artifacts look verrrry different to mine though, is there something else you are using? Some theme? Desktop manager?

Ah. Interesting.

I’m using Xfce 4.12. Adwaita style. Daloa window manager theme. When I change from Daloa to Default, something is different for the case with the optionboxes when style=“padding: 5px;” is present:

  • Daloa theme: window opens up smushed, no error in terminal.
  • Default theme: window opens up normal, but with that error message

What about just a hxWidgets / wxWidgets project? Remove haxeui.

For ref, this is wxWidgets under elementary os: https://github.com/wxWidgets/Phoenix/issues/698

haxeui cant solve wx issues like this.

I don’t know how to do that. Looking at the hxWidgets showcase, I could imagine this being a start:

import hx.widgets.App;
import hx.widgets.Frame;

class Main {
    public static function main() {
        var app = new App();
        app.init();

        var frame = new Frame(null, "hxWidgets");

        frame.layout();
        frame.show();

        app.run();
        app.exit();
    }
}

Did you managed to get any further with this? Or do you need me to knock up a test app in wx / hx widgets?

Cheers,
Ian

I stopped there. If you knock together a test app I’m happy to test and report back.

Given that the behaviour changes depending upon desktop manager theme, it sounded to me like it wasn’t a HaxeUI or hxWidgets bug.

Anyhow, my busy part of the year is starting up and unfortunately I’m not going to have as much free time as the previous couple of weeks.

OK, fair enough… ill knock up a simple wx example (via hxWidgets only) at some point and see how that runs on your system. As you say, it seems like its theme related rather than wx / hx widgets… still a shame though :frowning: