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

    full-journalist-82607

    02/03/2023, 7:44 AM
    You're not supposed to put the buttons in a an intermediary hbox I think
  • f

    full-journalist-82607

    02/03/2023, 7:47 AM
    You chose the direction of the button bar by using direction="vertical" for example
  • b

    bright-gpu-74537

    02/03/2023, 8:07 AM
    As yoplala said, your buttons need to be direct children of button bar
  • b

    bright-gpu-74537

    02/03/2023, 8:09 AM
    So nothing, there are no validators for forms, just fields, but a form is a kinda nice way to group them - so before the form "submits" it will see if there are any interactives with validators, if there are it will validate them, if they fail the form submission will cancel (and appropriate events / messages are dispatched)
  • b

    bright-gpu-74537

    02/03/2023, 8:22 AM
    eg:
  • b

    bright-gpu-74537

    02/03/2023, 8:22 AM
    Copy code
    haxe
            mainForm.onSubmitStart = function(_) {
                // clear any errors
            }
    
            mainForm.onInvalidData = function(event:ValidatorEvent) {
                // show some errors
                trace("invalid data");
    
                for (field in mainForm.invalidFields) {
                    trace("invalid field: ", field.id, mainForm.invalidFieldMessages.get(field));
                }
            }
            mainForm.onValidData = function(event:ValidatorEvent) {
                // all good
                trace("valid data");
            }
            mainForm.onSubmit = function(_) {
                trace("submitted");
            }
    You dont actually need to do any of this either, the default behaviour for the form is that it will shake and highlight invalid fields and cancel submission, the above is just if you want to customize it and show what is the problem
  • b

    bright-gpu-74537

    02/03/2023, 8:23 AM
    (and the submit button just calls
    mainForm.submit()
    )
  • b

    bright-gpu-74537

    02/03/2023, 8:27 AM
    ill be adding some examples to the explorer when i get some time, prolly over the weekend
  • r

    refined-greece-48002

    02/03/2023, 9:52 AM
    This looks like it will save a huge chunk of time on something I'm working on, so I'll probably leave by forms un-validated until it's good to go. I had a quick peek at using it the other day but invalid text boxes just went white on Heaps... However that may have been a cache issue as I've only just started using the compilation server after a few years of having it disabled 😅
  • r

    refined-greece-48002

    02/03/2023, 9:55 AM
    Super minor suggestion/question, but would you be interested in having properties with no value default to "true" like in jsx? So you could do
    <button id="my_button" disabled />
    Just purely for readability
  • b

    bright-gpu-74537

    02/03/2023, 9:59 AM
    seems fine... text seems off sometimes... probably im rounding something i shouldnt be
  • b

    bright-gpu-74537

    02/03/2023, 10:00 AM
    thats not valid xml though, so the xml would have to be "preparsed" i think... im not against it, im also not really a fan either... but it might be nice for some people
  • r

    refined-greece-48002

    02/03/2023, 10:01 AM
    Yeah, it would have to be done in that first step where you nicen up the xml I think. I was poking around there earlier
  • r

    refined-greece-48002

    02/03/2023, 10:11 AM
    Yeah, it would have to be done in that first step where you nicen up the xml I think. I was poking around there earlier
  • r

    refined-greece-48002

    02/03/2023, 10:11 AM
    Makes me wonder if having temperatures or intents for notifications etc might be cool. So you can say intent="warning" or intent="error" on those lil pop-ups and get a default style for that, which would then make it something uniform that could be overwritten in custom themes
  • b

    bright-gpu-74537

    02/03/2023, 10:12 AM
    thats kinda what already happens
  • b

    bright-gpu-74537

    02/03/2023, 10:13 AM
    Copy code
    haxe
            showNotification7.onClick = function(_) {
                var type = NotificationType.Info;
                if (notificationType.selectedItem.text == "Info") {
                    type = NotificationType.Info;
                } else if (notificationType.selectedItem.text == "Error") {
                    type = NotificationType.Error;
                } else if (notificationType.selectedItem.text == "Warning") {
                    type = NotificationType.Warning;
                }
                NotificationManager.instance.addNotification({
                    title: "Notification With Type",
                    body: "Notification types are a quick way to add generalized styling to a notification",
                    type: type
                });
            }
  • r

    refined-greece-48002

    02/03/2023, 10:13 AM
    You're miles ahead 😂
  • b

    bright-gpu-74537

    02/03/2023, 10:14 AM
    at the moment, it only changes the icon... but i might also apply some css to make it yellow, red, etc... im just not sure if i like that much color by default... ill see when i plug it all into a real application
  • b

    bright-gpu-74537

    02/03/2023, 10:15 AM
    🙂 Always room for improvement, but this what you can pass to the notification system currently:
    Copy code
    haxe
    typedef NotificationData = {
        var body:String;
        @:optional var title:String;
        @:optional var icon:String;
        @:optional var actions:Array<String>;
        @:optional var expiryMs:Int;
        @:optional var type:NotificationType;
        @:optional var styleNames:String;
    }
  • b

    bright-gpu-74537

    02/03/2023, 10:19 AM
    any idea why this might be happening:
  • b

    bright-gpu-74537

    02/03/2023, 10:23 AM
    ah, nvm, i can see why, its because i change the font size in those components and heaps doesnt do well with that... forgot about that
  • b

    bright-gpu-74537

    02/03/2023, 10:24 AM
    better 🙂
  • b

    bright-gpu-74537

    02/03/2023, 11:29 AM
    ok, so "all green" does look quite good
  • b

    bright-gpu-74537

    02/03/2023, 11:29 AM
    instantly draws the eye i think, whereas the "normal" one didnt really... so i might make the type linked to the css after all
  • a

    ambitious-knife-25690

    02/03/2023, 11:43 AM
    agree!
  • b

    bright-gpu-74537

    02/03/2023, 1:15 PM
    ... works for me... 🥳
  • a

    ambitious-knife-25690

    02/03/2023, 1:27 PM
    looks nicee 😄
  • a

    ambitious-knife-25690

    02/03/2023, 1:27 PM
    A small touch but I think it's a big effect
  • b

    bright-gpu-74537

    02/03/2023, 1:29 PM
    yeah, i try not to add too much colour to the inbuilt themes as i want them to kinda be "bland" so people will want to change them... but i guess this is an exception... also the "Default" one is the white boring one...
1...145914601461...1687Latest