https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • b

    bright-gpu-74537

    04/25/2023, 3:11 PM
    > btn.icon.getImageDisplay() the correct want would be:
    button.findComponent("icon").getImageDisplay()
    , or
    button.findComponent(Image).getImageDisplay()
    , but note that with either of these methods you code will either break on native builds (not that i think you care about that)
  • b

    bright-gpu-74537

    04/25/2023, 3:11 PM
    is there a reason you want to access the image display directly?
  • h

    helpful-boots-41914

    04/25/2023, 3:12 PM
    Conditionally generated list of images and buttons* - and so providing icon with an image would require me to set the extents somehow.
  • b

    bright-gpu-74537

    04/25/2023, 3:15 PM
    i mean, the way i might be tempted to tackle it, is either by using the
    tile://
    extension in the .icon string, or, having a class that returns haxeui images, and use them:
    Copy code
    haxe
    function getImage():Image {
        ...
        theImage.getImageDisplay().subImage(...)
        return imageDisplay();
    }
    
    ...
    
    myButton.icon = getImage();
  • b

    bright-gpu-74537

    04/25/2023, 3:15 PM
    at least that way you dont have to get dirty with the button internal (or any other components, esp list/table item renderers)
  • h

    helpful-boots-41914

    04/25/2023, 3:17 PM
    > a class that returns haxeui images You mean like
    var theImage = new haxe.ui.Image(); theImage.resource = Images.aTexture; . . .
    ?
  • b

    bright-gpu-74537

    04/25/2023, 3:18 PM
    yeah, you should be able to assign images to icon properties too
  • b

    bright-gpu-74537

    04/25/2023, 3:18 PM
    unless i just imagined that... 😄
  • h

    helpful-boots-41914

    04/25/2023, 3:19 PM
    Got it. Okay that should work for me then, I can use that. And yes you can assign
    Components
    to icon so I think that works
  • b

    bright-gpu-74537

    04/25/2023, 3:19 PM
    yeah, its fine, phew: http://haxeui.org/builder/?e9f0a2d6
  • b

    bright-gpu-74537

    04/25/2023, 3:20 PM
    Copy code
    haxe
            var image = new haxe.ui.components.Image();
            image.resource = "haxeui-core/styles/default/haxeui.png";
            test.icon = image;
  • b

    bright-gpu-74537

    04/25/2023, 3:21 PM
    you can do it your way, and for something like button its pretty simple... but what about icons in a listview? Or a custom item renderer, you gonna find each instance of an image, and access the backend specfic ImageDisplayImpl? What about when you add items to a list, etc... feels like a huge pain when you can just let haxeui intepret what the "icon" value is
  • h

    helpful-boots-41914

    04/25/2023, 3:23 PM
    I think I am going the approach of using a haxe ui image as the icons. That's what you suggested right?
  • b

    bright-gpu-74537

    04/25/2023, 3:24 PM
    yeah, pretty much, and then you can access the getImageData().subImage in them, but you avoid having to say "where does this image go in the button" (for example), or "how can i get the image out of a button so i can call subImage", you give it the (haxeui) image and say "use this one"
  • b

    bright-gpu-74537

    04/25/2023, 3:25 PM
    cleaner and you dont care about whats going on internally in the button (or where its putting things)
  • h

    helpful-boots-41914

    04/25/2023, 3:30 PM
    Right, sounds like the right approach. Thanks man!
  • e

    early-butcher-76809

    04/25/2023, 4:36 PM
    Is there a simple way to have a free layout, like absolute but without giving pixel positions/size ? Like absolute with %ages. Pixel values aren't really responsive ^^
  • b

    bright-gpu-74537

    04/25/2023, 4:48 PM
    not really, % left / top arent things (in haxeui)
  • e

    early-butcher-76809

    04/25/2023, 4:49 PM
    Yeah, just saw that. Would I need to add percentTop/Left, as Width/Height then use that in the AbsoluteLayout.repositionChildren ?
  • b

    bright-gpu-74537

    04/25/2023, 4:50 PM
    essentially, but also parse it all in the macros, etc... certainly not a small change tbh
  • e

    early-butcher-76809

    04/25/2023, 4:50 PM
    Ah ? :(
  • b

    bright-gpu-74537

    04/25/2023, 4:50 PM
    i mean, its not immense, but its not tiny either
  • e

    early-butcher-76809

    04/25/2023, 4:51 PM
    Crap, I hoped I could get away with only adding stuff in Style.mergeDirectives ^^'
  • b

    bright-gpu-74537

    04/25/2023, 4:52 PM
    that would parse it into the style, yeah (few other things you'd need to do there also), but presumably it would also want to be an xml attr (
    <box left="10%">
    )... i do like the idea (i think), but i think if its going to be done, it make sense to do it proper... whats the use case here btw (just so i can understand fully)
  • e

    early-butcher-76809

    04/25/2023, 4:53 PM
    Pretty much just doing a responsive absolute
  • e

    early-butcher-76809

    04/25/2023, 4:54 PM
    If I modify the size of my asolute, I'd like the elements inside to change size too while staying at their relative position
  • e

    early-butcher-76809

    04/25/2023, 4:54 PM
    In case a pesky UI designer goes "I'd like to make this thing smaller/bigger" :P
  • e

    early-butcher-76809

    04/25/2023, 4:55 PM
    Or if I have a different target resolution
  • e

    early-butcher-76809

    04/25/2023, 4:56 PM
    Since I use VH and VW pretty much everywhere
  • b

    bright-gpu-74537

    04/25/2023, 4:58 PM
    ill have a think about it... would % padding be more / less useful?
1...165116521653...1687Latest