Called when the panel has finished loading

Home Forums General Programming Called when the panel has finished loading

Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #71844
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    ok: for future newbs: i resolved this, it is very simple:
    do not use setVisible, use setProperty(“componentVisibility”).
    that’s how it is done. there you go, not a secret now. simple.
    ————————————————————–
    ‘Called when the panel has finished loading’

    i have a notion that something should happen once
    Ctrlr has loaded the panel. refresh, repaint? i don’t
    know how to use these.

    my panel is loading showing stuff that should be hidden,
    and these are controlled by Lua using ‘setVisible’, which
    are activated when another control is changed.

    i read a post by Goodweather, saying it is good practice
    to declare all your modulators at panel load – eg?when finished
    loading? i would like to understand more about what happens
    as a panel loads.

    is it getValue() for the parameter that controls the hide/show
    modulators(groups) – or use redraw/refresh/repaint?

    would you then combine all the functions you need to run into
    one Lua method, so that they all happen at startup, to initialise
    the panel?

    what other things can happen when Panel has Finished Loading?

    #71857
    goodweather
    Participant
    • Topics: 45
    • Replies: 550
    • Total: 595
    • ★★★

    Well, that’s the idea. You initialize the panel with the method called with that property “Called when the panel has finished loading“.

    What other things can happen? Well, basicaly anything you want (you are programming!)…
    Typicaly, initializing means defining variables, setting initial values, etc…

    Please note that I remember having had surprises with SetVisible not working well all the time or not initializing well and I used work arounds most of the time unless I was sure the method was working well.

    #71860
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    ok, so if i declare all modulators…at least all the ones
    that do something,.. i’m show/hiding groups, so i guess those are
    modulators i need to refer to, so i have to declare those too.

    i saw you’d asked about setVisible. did you ever get it loading
    correctly?

    #71899
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    hi Goodweather,
    i can now illustrate the issue i’m having, with this panel:

    PartialOps_v13.zip

    https://app.box.com/s/imkjtdilauit0icq5s68a35br5w5t8k7

    if you load it unlocked/parameter panel showing, it always shows
    both views until you activate the ‘structure’ controls, that determine
    what is showing. same with Bank select, and the 2 pcm list views.

    there isn’t a ‘panel loaded’ lua here yet. i’m wondering how i could
    initialize something like this (without sending out any midi messages).

    #71920
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    had a look at other panels, where there are a few examples of
    methods for panel loading.

    i have the modulator that dictates the views linked to another
    modulator (same value, link both ways), only one calling the
    method.

    • This reply was modified 5 years, 2 months ago by human fly.
    #71934
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    i put it on a button that resets views.
    but i wasn’t successful incorporating this into a
    ‘when panel has loaded’ method – and i’ve now twice
    had dire crashes after messing with this parameter,
    first ending up with a re-install of ctrlr, which
    got me up and running again, and now the same thing
    happening again, and i’m apparently unable to run
    ctrlr at all, with it crashing on startup, trying
    to restart, and crashing, in a loop, until i stop
    it via task manager.

    absolutely no idea what is going on, or how to
    fix it at this stage; i’ve moved/renamed the files
    involved, and several fresh installs haven’t fixed
    it.

    • This reply was modified 5 years, 2 months ago by human fly.
    #71939
    proton
    Participant
    • Topics: 19
    • Replies: 94
    • Total: 113
    • ★★

    Hi human fly,
    no idea why it crashes but just a reinstall may be not enough.
    Go here C:\Users\XXXXXyournameXXXX\AppData\Roaming\Ctrlr and move all the folders from inside of this folder to some other location. Ctrlr is storing there all your panels and methods so if something is really going south clean this folder and Ctrlr will be forced to rebuild its content instead of reading from it.
    I hope this help with your troubles.
    Cheers!

    #71940
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    thanks – i’d forgotten about that. looked for that ‘Roaming’
    folder but ended up looking at another one that is empty.
    found it now, it was ‘greyed out’, so i thought that one was
    inaccessible.

    ‘move ALL the folders’ -instead of delete? can’t i get
    rid of these? my main files are elsewhere.

    this is the 2nd time i’ve trashed my Ctrlr startup trying to
    make a ‘panel loaded'(when panel etc) method. even going back
    and editing the file in notepad didn’t work – i renamed the
    method so it couldn’t be found. worked a couple of times
    previously, but not here.

    #71941
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    ok, i put everything related to Ctrlr in a folder and moved it.
    had to remove the ctrlr.settings file, that’s the culprit.

    but now i seem to have removed my image resources – the projects
    aren’t finding them – interesting: i’m wondering how this folder
    works, compared to a ‘temp’ folder, and why the ctrlr files don’t
    reference the original location, AND: at what point a roaming subfolder
    is created: is it when you draft a restricted instance? ie: wrapping
    to panel file with its resources.

    i posted the crash report details in the topic about this here:

    Ctrlr crashing in a loop on start

    #71944
    proton
    Participant
    • Topics: 19
    • Replies: 94
    • Total: 113
    • ★★

    Hi human fly,

    every time you create a new panel there will be an UID created with it so even if you rename your panel from “Roland-BlahBlah” to “Nord-XXX” for Ctrlr this doesn’t matter. What matters is the UID of the panel. This is how the panel is recognized by Ctrlr. On panel creation a folder is created inside your …AppData\Roaming\Ctrlr (see attached pics) and all assets that has to do with your panel (imported PNGs etc) will be placed there. If this folder is missing and you open a panel that was exported without resources Ctrlr will be missing all those data so your background pictures and knobs graphics etc are all blank.
    As you can see on the attached picture you can’t change the UID of a n already created panel but you can Re-Generate it meaning a new UID will be created, new folder with the same name will be created and from now on you are working on a copy of your panel that might have the same name as before (Nord-XXX) but all the assets are placed in the new folder. I use this technique while testing stuff and in case something goes wrong I can always go back to some previous version that I’m sure worked properly.
    Cheers!
    https://s21.postimg.org/xb99dd0qv/roaming-0.png
    https://s21.postimg.org/aybo8frjr/roaming-1.png

    • This reply was modified 5 years, 2 months ago by proton.
    • This reply was modified 5 years, 2 months ago by proton.
    #71946
    proton
    Participant
    • Topics: 19
    • Replies: 94
    • Total: 113
    • ★★

    Can’t upload any pictures to Ctrlr server so I will post links to them.

    BTW, forgot to mention that before – sometimes you don’t need to delete those folders or relocate them but only delete the “Ctrlr.settings” file from the main “Ctrl” folder or from your particular panels folder. This forces Ctrlr to boot with default settings.
    Cheers!

    • This reply was modified 5 years, 2 months ago by proton.
    • This reply was modified 5 years, 2 months ago by proton.
    #71954
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    i kept them, i think i might have to put’em back.
    going to have a little shortcut to that folder…

    what i do is just save the panel with a new name at each step
    i want to mark as a change, with number and descrptive suffix.

    i’m still have no joy with this ‘when panel has finished loading’
    thing for setVisible().

    not too clear where this function gets called in the loading
    process. maybe i just did something stupid like forget to rename
    the function. need my own little function header with –*rename
    the ****en function* at the top.

    #71955
    goodweather
    Participant
    • Topics: 45
    • Replies: 550
    • Total: 595
    • ★★★

    About the Save, it is very simple and efficient. I copy here what I put in my updated Step by Step guide 2.0.
    Under File, select Save or Save As to save your panel. A file with .panel as extension will be created.
    When you use Save, you are saving your work in the current panel file. When you use Save versioned, you are storing the whole panel in a new file as DSI Pro2_1_0_2017-03-20_16-02.panel while staying in the current panel file. The filename of the “Saved versioned” file is automatically created and includes the current version and date/time. The Version MINOR panel attribute is incremented automatically at each save versioned.

    About SetVisible, I don’t remember but I think I just avoided touching that at panel load…

    #71956
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    i’m happiest doing what i do now, just rename each
    stage as i progress, make a new file. not too confident
    with save versioned – but i do know now how to change
    the default save location! that’s what put me off before.

    i can now make the thing reset the views, under certain
    conditions, but it’s sending out 4 sysex messages as it loads.

    #71994
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    ok: i can run a ‘panel loaded’ method now, clear on that.

    i would like some clarification of some things i’ve
    observed, and some info i’m picking up:

    toggling ‘panel mode’, brings back the views i have
    hidden with setVisible. this doesn’t seem to mean it
    will load wrong in the end exported version: i have
    exported ‘exe’ versions that run ok, but don’t as *.panel
    files. (re:component visibility on load)

    so i’m interested in what is going on there. panel mode on/off,
    and what is the difference in those states of the program:

    getRestoreState()
    getProgramState()
    getBootstrapState()
    (not familiar with meaning of ‘bootstrap’, soz..)

    i can save it in Panel Mode, and it opens well – although there’s
    something going on there: it only opens well if the values on the
    main parameters (controlling the views) are saved different from
    their intended startup values, and need to be changed on load,
    ie: ? activated ?

    i also read that MIDI output is suspended with getRestoreState,
    -when it is ‘true’? – well, i’m having a problem with 4 sysex
    messages being sent out as Ctrlr starts(or as the panel loads).
    i can’t see any reason -yet- why these modulators might be
    sending out MIDI at that point – was not doing it before)

    #72018
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    i’ve found Goodweather’s post about this. iceleben was having
    the same problem, and ended up at the same solution: get load-up
    to read a dummy button.

    strange behaviour of setVisible during startup

    *i see*: you suggest actually switching the visibility off for those
    objects in Properties pane. wow, how did you think of that ? 🙂
    i will give it a go now.

    edit: it doesn’t go ‘invisible’ when i untick that 🙁 it just goes
    greyed out.
    edit: oh it does go invisible when you tick ‘panel mode’..and i saved
    and re-opened – without a panelloaded method – and yes, they are all
    invisible, until i click my ‘reset’ button which has a setVis’ method.

    ok, very good. so far so good.. now i just have to use ‘panelLoaded’
    to set up an initial view. or something: i anticipate another problem,
    because these depend on another parameter – and i don’t want that to
    send out a sysex message as its value is reset.

    so:(i think?) you identified that the component was getting conflicting
    setVis’ instructions – in fact: the final ‘properties’ are overriding
    what the lua has set? so, in a way, you ‘disconnect’ that, and let the
    ‘setVis’ have a less fixed visibility, so it is free to be controlled
    only by lua. (something like that)

    ah: some progress at last 🙂

    #72057
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    um, in fact i’ve now put it back, with the property default
    at ‘visible’ – because it isn’t making much difference, and
    isn’t ideal for working at this point.

    what seems to make more difference is whether anything needs
    changing on load or not: if the parameter value has to be
    changed to match the default load value, views set correctly.
    if the value is already ok, and nothing has to change, both
    views show.

    so i don’t even know if it is the modulatorValueChanged lua doing it.

    the other thing to try is another setvisible function, using
    one of the setProperty.. methods, especially if i’m setting it
    invisible with the button beforehand. back to the drawing board.
    i want to nail a reliable way of doing this.

    i came across this post by Atom, with a list of Ctrlr methods,
    which i assume cross references with the github *.h files.
    would like to know more about key methods here, and how
    various versions with similar names differ. i guess the github
    pages give the parameters, and there’s a description there.
    (this all has to go in the lua section of the ‘manual’ !)

    waveform component example

    #72080
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    can now provide a demo to illustrate much better:

    zip 4.9mb
    https://app.box.com/s/saltiv2px1wqgb41wi3oxdozxl2y567v

    zip has (win)*.exe and *.bpanelz – realised that the b(inary)panelz
    format can include reZource fileZ for images etc. and is the
    best format for distributing demo files.

    this shows how it opens in both formats.(ctrlr 5.4.29)
    (note how it clips the bottom off the rendered size)

    the group views seem to be loading ok in the exe.
    strange thing is that if you change ‘structure’ and close
    without saving, that is how it will open next time. don’t
    know how this would work on a system where Ctrlr main prog
    is not installed. does it write an *.inf file somewhere on
    first run, and close?

    in the bpanelz, first look i had, it looked messed up
    (just now) – but it’s all in there if you want to have
    a look and messaround with it.

    i’m ok with this for inclusion in my main panel
    for now. the ‘structure’ image sliders might seem
    a bit weird to use. seemed like the best semantic
    for what it does, once you know what it’s for: ie:
    you see what it is, no text.

    #72082
    Possemo
    Participant
    • Topics: 14
    • Replies: 638
    • Total: 652
    • ★★★

    Clipping is a very old bug. You have to add 24 pixels to get the bpanelz right.

    #72085
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    thanks for that info. so 24 pixels is ~approx 1cm..?

    http://www.unitconversion.org/typography/pixels-x-to-centimeters-conversion.html

    no: 0.635cm, officially. mm, i was thinking a bit more…
    (did it download ok?)
    – – – – –
    see opening post for solution to original issue
    eg: item visibility

Viewing 20 posts - 1 through 20 (of 20 total)
  • The forum ‘Programming’ is closed to new topics and replies.
There is currently 0 users and 66 guests online
No users are currently active
Forum Statistics
Threads: 2,495, Posts: 17,374, Members: 77,605
Most users ever online was 12 on January 22, 2019 3:47 pm
Ctrlr