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

    best-agent-85158

    08/03/2022, 7:41 AM
    its hard to repro because it appears and goes away randomally
  • b

    best-agent-85158

    08/03/2022, 7:41 AM
    i can compile without changing the code and it somehow works
  • b

    bright-gpu-74537

    08/03/2022, 7:41 AM
    its even harder for me to try and fix something that isnt reproducible 🙂
  • b

    best-agent-85158

    08/03/2022, 7:41 AM
    but when it doesnt work it just doesnt watn to work again
  • b

    best-agent-85158

    08/03/2022, 7:41 AM
    i kno i know 😦
  • b

    bright-gpu-74537

    08/03/2022, 7:42 AM
    are you you doing something special (or crazy) in your dropdowns?
  • b

    best-agent-85158

    08/03/2022, 7:42 AM
    nah not really. maybe selecting index
  • b

    best-agent-85158

    08/03/2022, 7:43 AM
    ill try stuff. ill update when solved
  • b

    bright-gpu-74537

    08/03/2022, 7:45 AM
    i mean, it looks sensible, your selectedIndex code is... ... ... ... interesting... but i dont think it should cause a problem
  • b

    best-agent-85158

    08/03/2022, 7:50 AM
    Main.registerFonts(fonts);
  • b

    best-agent-85158

    08/03/2022, 7:50 AM
    this is the line that causes the error
  • b

    best-agent-85158

    08/03/2022, 7:50 AM
    Copy code
    haxe
    public static function registerFonts(dropDown:DropDown) {
        final prefix = "assets/fonts/";
        #if js
        dropDown.dataSource.add({text: "Rubik"});
        dropDown.dataSource.add({text: "Arial"});
        dropDown.dataSource.add({text: "Times New Roman"});
        dropDown.dataSource.add({text: "Courier New"});
        #else
        #end
    }
    why tho
  • b

    bright-gpu-74537

    08/03/2022, 7:50 AM
    fyi, i think this looks cleaner and easier to follow, but could just be me:
    Copy code
    haxe
    function getFontIndex(selectedText:String):Int {
        if (selectedText == null) {
            return getFontIndex(PageEditor.GLOBAL_TEXT_FORMAT.font);
        } else if (selectedText.contains("Rubik") {
            return 0;
        } else if ((selectedText.contains("sans") {
            return 1;
        } else if ((selectedText.contains("serif") {
            return 2;
        } else if ((selectedText.contains("typewriter") {
            return 3;
        }
        return -1;
    }
    
    ...
    ...
    ...
    
    myDD.selectedIndex = getFontIndex(text);
  • b

    bright-gpu-74537

    08/03/2022, 7:50 AM
    hmmm, that seems totally fine
  • b

    best-agent-85158

    08/03/2022, 7:51 AM
    (that function chooses default fonts on JS and searches for fonts in sys, just not yet implemented in sys)
  • b

    bright-gpu-74537

    08/03/2022, 7:52 AM
    sure, its just the duplication and the "everything is an expr in haxe" overuse... probably personal pref...
  • b

    bright-gpu-74537

    08/03/2022, 7:52 AM
    ¯\_(ツ)_/¯
  • b

    bright-gpu-74537

    08/03/2022, 7:52 AM
    anyways, unimportant
  • b

    best-agent-85158

    08/03/2022, 7:52 AM
    ill try to put the function body in the code and see if that makes a difference
  • b

    bright-gpu-74537

    08/03/2022, 7:53 AM
    i doubt thats it tbh... i mean, i dont think there is a return value from that if that could / should break it
  • b

    bright-gpu-74537

    08/03/2022, 7:56 AM
    actually, are you sure you can use if statements like that? Ie, "var x = if (true) 10;"
  • b

    best-agent-85158

    08/03/2022, 7:57 AM
    i know what causes the error
  • b

    best-agent-85158

    08/03/2022, 7:57 AM
    this line:
    Copy code
    haxe
    fonts.percentWidth = 100;
  • b

    best-agent-85158

    08/03/2022, 7:58 AM
    really weird but ok
  • b

    bright-gpu-74537

    08/03/2022, 7:58 AM
    ill need to see more of the UI code in order to understand
  • b

    bright-gpu-74537

    08/03/2022, 7:59 AM
    like... whats "g" and what is its parent, etc, etc
  • b

    best-agent-85158

    08/03/2022, 7:59 AM
    im really sorry
  • b

    best-agent-85158

    08/03/2022, 8:00 AM
    https://pastebin.com/91cZKLCn
  • b

    bright-gpu-74537

    08/03/2022, 8:17 AM
    hmm, i mean, its pretty hard to follow, but i think it all makes sense... basically a grid with 2 cols and 3 rows, first row is two steppers in an hbox (with an "x") inbetween and the last two rows are dropdowns where the dropdown should take the up rest of the space of the cell
  • b

    bright-gpu-74537

    08/03/2022, 8:21 AM
    seems fine... thats haxeui-html5 though and using xml
1...119311941195...1687Latest