Closed melMass closed 5 years ago
what versions of haxeui-*? Demo i think does have issues in native in the sense that some components dont have native counterparts yet (iirc)
I'm using haxeui-hxwidgets
Version: 1.0.3
I've stripped down the sample and the culprit is itemRenderer
is there an alternative for a list of images on native?
Also, where can I learn how to bind the UI to Haxe and things like that ? There seems to be many ways to do it.
Ok, so this is exactly the thing ive been actively working on today. The issue is when you use native components, they dont really conform to the idea of "ItemRenderers" so, for the most part they simply wont work as you expect (for example, native listviews can have a single icon and a single label). However, you do have a few options:
The first, would be to just use a "ScrollView" and put all your images in there, this would work, but then you would have to maintain the items in there if you wanted to do anything remotely "interesting" with it.
The second would be to use the listview, but not native. This means it would still technically be native (in the sense everything, including the scrolls would be native windows) but the whole control, and its innner workings are no longer delegated to the host framework (wx in this case) and are managed internally by haxeui, as a so called "composite" component. This is, to me, the best option for your "list of images". However there are some issues that im currently working on for it.
<style>
.listview, .listview .even, .listview .odd {
background-color: none;
}
</style>
<listview native="false">
...
</listview>
or
myList.native = false;
If you take a look at the listviews example (https://github.com/haxeui/component-examples/tree/master/listviews), and set the "virtual" attribute to false in the xml, or remove it, or change it to "native", and are using git version of the lib, and have that style above, then you should end up with something like:
Its not completely ideal, i would like the alternate rows to have a different colour and will get these from wx at some point (the facility is already there: .odd { background-color: platform-color(something); }
)
I realise there is some hoops to jump through at the moment, but hopefully its not too bad and will become ALOT easier once ive got it all wired up correctly
Sheesh, that was a long answer!
Cheers, Ian
Thanks for the extensive report! Yes, it's kind of working doing the modification you suggested. I'll report back here once I have my basic layout done to be more precise!
Cool - let me know if you hit any issues. FYI - most of the above is now in git (styles, etc). Below is the listview sample with virtual=true
removed and native=true
added:
For some reason this is how it looks like on my side doing the same modifications:
This is the trace when building:
Warning : Should be used in initialization macros only: haxe.macro.Compiler.define(source-header, GeneratedByHaxe)
/usr/local/lib/haxe/lib/haxeui-hxwidgets/git/haxe/ui/backend/DialogBase.hx:75: characters 19-26 : hx.widgets.StdDialogButtonSizer has no field realize
/usr/local/lib/haxe/lib/haxeui-hxwidgets/git/haxe/ui/backend/ComponentImpl.hx:88: lines 88-90 : Field get_isNativeScroller is declared 'override' but doesn't override any field
Looks like you have a) updated hxWidgets (git version), haxeui-core (git version), haxeui-hxwidgets (gitversion)
Also, did you set "native=false" on <listview/>
nodes?
Yes I've run:
haxelib git haxeui-core https://github.com/haxeui/haxeui-core.git
haxelib git haxeui-hxwidgets https://github.com/haxeui/haxeui-hxwidgets.git
haxelib git hxwidgets https://github.com/haxeui/hxwidgets.git
No error message during runtime, just the one I specified at build time
I think case might be important? ie,
haxelib git **hxW**idgets https://github.com/haxeui/hxwidgets.git
And those are defo compiler errors, not runtime errors. Are you comfortable with "haxelib dev"? Maybe haxelib git has broken something? Maybe ill create a release, im pretty happy they work fine. Would be interesting to see why your install is broken though as using haxelib git
/ haxelib dev
will be pretty important for "cutting edge" features
Unfortunately, that is not the culprit:
haxelib remove hxwidgets
haxelib git hxWidgets https://github.com/haxeui/hxwidgets
Building gives the same result. I'm not sure how to debug it myself.
i guess the first thing to check is hx.widgets.StdDialogButtonSizer` (which is part of hxWidgets) - that should have the "realise" function as defined here: https://github.com/haxeui/hxWidgets/blob/master/src/hx/widgets/StdDialogButtonSizer.hx#L20-L22
One thing ive just noticed is this file here: https://github.com/haxeui/hxWidgets/blob/master/src/StdDialogButtonSizer.hx is in the wrong place and is duplicated in src/wx/widgets/
... i wonder how that got there... ill get rid of it
Another thing might be manually delete the haxelibs yourself, ive had issues in the past where haxelib git never updated - might be fixed now, but ive certainly had to do it previously
It tried different approaches (reinstalling Haxelibs by first deleting them manually) but I'm still getting the same result
Just after answering this thread I tried to update and I had an issue about App Implementation, looking at the commits I realized this was added after I last updated.
About the issue of updating git haxelibs you are right! I think haxelib won't update the lib if the version number is the same (even if the sources changed). And your new App Implementation made it work !!
But now I have a little issue, some list items can't be clicked and trying to Remove 100
crashes the app, here is a video:
You told me you are actively working on it, so tell me if my reports are useful or not at that stage?
I really love what you have done with Haxe-UI
You reports are certainly useful - for sure! Im still not convinced you have the latest version of haxeui-hxwidgets, or haxeui-core... you dont have any alternating colours in the lists, which you should have now... Do you still have the css i suggested above? Basically, revert the listview demo to its original, but remember to add "native=false" on the xml
Hm that's strange here are the exact steps I'm doing:
# Remove existing
RM -rf /usr/local/lib/haxe/lib/hxwidgets
RM -rf /usr/local/lib/haxe/lib/haxeui-*
# Install Libs from Git
haxelib git haxeui-core https://github.com/haxeui/haxeui-core.git
haxelib git hxWidgets https://github.com/haxeui/hxwidgets.git
haxelib git haxeui-hxwidgets https://github.com/haxeui/haxeui-hxwidgets.git
I'm starting over from the sample repo and I'll report if it solves it
I'm not getting how this can happen but I replaced virtual="false" with native="true"
And now i'm getting a weird error:
Warning : Should be used in initialization macros only: haxe.macro.Compiler.define(source-header, GeneratedByHaxe)
src/Main.hx:11: characters 34-83 : Uncaught exception Null Access
/usr/local/lib/haxe/lib/haxeui-core/git/haxe/ui/core/ComponentClassMap.hx:14: characters 17-52 : Called from here
/usr/local/lib/haxe/lib/haxeui-core/git/haxe/ui/macros/ComponentMacros.hx:145: characters 32-61 : Called from here
/usr/local/lib/haxe/lib/haxeui-core/git/haxe/ui/macros/ComponentMacros.hx:126: characters 9-63 : Called from here
/usr/local/lib/haxe/lib/haxeui-core/git/haxe/ui/macros/ComponentMacros.hx:106: characters 9-68 : Called from here
/usr/local/lib/haxe/lib/haxeui-core/git/haxe/ui/macros/ComponentMacros.hx:77: characters 9-88 : Called from here
src/Main.hx:11: characters 34-83 : Called from here
src/Main.hx:7: lines 7-17 : Defined in this class
I'll continue to find the cause, but posting just in case that sound familiar to you
hmmm, any chance you can zip you project? Is the xml "well formed"?
It's a copy of the repo I just cloned. I have a meeting but I'll be back in a few hours and will report properly.
cool - well, if you get a moment, send the zip over anyway, there maybe be some subtle difference, and that error isnt very useful, so if possibly id like to fix that and give a better error back.
Cheers, Ian
empty .zip it seems :)
Sorry here it is
OK, the xml isnt valid:
<style>
.listview, .listview .even, .listview .odd {
background-color: none;
}
</style>
<vbox style="padding: 5px;">
...
</vbox>
thats not valid xml, your <style>
element needs to be under another node, ie, you can only have one root node
In this case its the fix i mentioned above, which is no longer needed so you can just remove it entirely.
🤦♂ ...
Dumb one sorry..
It now builds ( I still needed to add -D disable-unicode-strings
on macOS Mojave)
The list now behaves correctly! (Selectable etc..) but segfaults on Remove 10
or Remove 100
.
Thought those issues and your answers I managed to solve the things that blocked me from really taking the time to discover haxe-ui. I will do now. The error must be some kind of memory leak
Here is how it now behaves|look on my end: https://imgur.com/a/rmqXld2
Perfect! Glad its working! Ill check out the remove, it will either be an issue with the demo application or the framework, either way, it shouldnt be too hard.
:)
Thanks again
No problem! Thanks for taking the time to work through the issue(s). :)
FYI: that crash when you try and remove an item is fixed now :)
Just tested I can confirm that !
I'm getting:
When trying to build the
listviews
anddemo
samples. It seems to be related to the<itemrenderer>
as a simple list work.Using macOS | Haxe 4 | WxWidgets 3.1.3