Drawing Canvas Object - Can I do this? How? is it Safe?

  • Yes, I do have 2 "On open dialog OK" but they're separated by different buttons, under different groups (as shown on the images above) I guess that's not enough! :(

    No, that's not enough. The simplest solution is to put them into two different groups and activate/deactivate them depending on what button was pressed, making sure only one group is activated at a time.

  • By the way, Save/Load and Undo system will not be able to restore custom images (which you load into sprites or drawing canvas). You'll need to restore them with events from saved binary data, or from disk files, it's a whole different and quite complicated topic of discussion...

  • > Yes, I do have 2 "On open dialog OK" but they're separated by different buttons, under different groups (as shown on the images above) I guess that's not enough! :(

    No, that's not enough. The simplest solution is to put them into two different groups and activate/deactivate them depending on what button was pressed, making sure only one group is activated at a time.

    I will try to do that since it's also organized as I like! now it make sense to me what you meant thanks for explaining! :)

    By the way, Save/Load and Undo system will not be able to restore custom images (which you load into sprites or drawing canvas).

    It's good to know, I keep learning more about the limits which is very important.

    I think I can handle without undo it since I always have the option to click a button to clear the canvas so it's no big deal I think, also I don't want to get my software super complicated then it's already.

    I'm planning to keep adding minor cosmetic features once I'll get rid of the current scary bugs.

  • The simplest solution is to put them into two different groups and activate/deactivate them depending on what button was pressed, making sure only one group is activated at a time.

    Now... I did a big mess, I started to setup the boolean and I got confused (it was easier in my mind, until I tried to get it to C3) I understood the idea of: ONLY one group Enabled at a time while disable the other and vice versa.

    So, this is what I did but overall code became less organized than it was and it's confusing me: (blaming myself only)

    And I'm pretty sure I'm not triggering them as I should and that's why nothing is working anymore, here I test the LOAD button first:

    The question is: should I get back to the old version since I didn't have issues (yet) ?

    or am I close to get this right... STUPID MODE: ON (again)

    To be honest, not only I have a feeling I made things even worst now... :|

  • If you decided to go with groups, you don't need the boolean flag!

    "On LoadProjectButton pressed -> NWJS Show open dialog, Activate "Load project" group, Deactivate "Load image" group

    "On LoadImageButton pressed -> NWJS Show open dialog, Deactivate "Load project" group, Activate "Load image" group

    That's it!

  • If you decided to go with groups, you don't need the boolean flag!

    "On LoadProjectButton pressed -> NWJS Show open dialog, Activate "Load project" group, Deactivate "Load image" group

    "On LoadImageButton pressed -> NWJS Show open dialog, Deactivate "Load project" group, Activate "Load image" group

    That's it!

    Thanks, it may look MUCH cleaner with this way, now.. to what I did:

    First thing, I followed your suggestion: (unless I didn't got it right from the text)

    1. Click the button

    2. On Open dialog OK

    3. Group Activate (itself)

    4. Group Deactivate (the other one)

    But when I put the activate/deactivate actions AFTER "On open dialog OK" it won't execute the rest of the actions probably because it's disabling it's own group BEFORE the next actions which make sense I guess. (no logs on the console when I click any of the buttons).

    So I tried to put the group actions at the end of each event:

    with the above alternative only Load Project Button works, Import button does not (no log appears on the console as well).

    Both groups starts activated by default, So where.. and in what order do I put these actions?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Please read my previous comments again.. Seriously, it can't be more straightforward:

    ButtonA pressed: activate group A, deactivate group B
    
    ButtonB pressed: activate group B, deactivate group A
    
  • My STUPID mistake wasn't even the order (because I did exactly what you suggested above as one of my tries)

    it was because I should've put the Buttons events OUT of the groups that I enable/disable... ehhh I wish I had a better brain (must upgrade to a newer version!)

    I don't like the way it's placed at the moment (probably will change), but it works:

    OK, now that it works, it must be more efficient that it was as you suggested, the console shows it as it should with the correct logs on clicking the buttons, so far so good!

    COULD IT BE?... I just imported and that RED warnings are gone!

    I'm still playing around with more and more options to see if something else won't work, but on a rough test there are no SCARY red warnings as I had when I imported PNG files BEFORE this organized activation you suggested.

    MY NEXT GOAL! I already made a progress but but it looks not exactly correct so I'll try to solve it as I always do only if I'll still wonder about it, I'll show the result here,but first I'll better try solve this by myself (it's not a bug but a numbers thing I believe)

    Thanks once again sensei dop2000 :)

  • 1. I import PNG image to the BG_user, looks NICE as expected.

    2. I press the tilde key, it will clear the imported PNG from the BG_user frame.

    Simple, and it works smooth. :)

    BUT! when I press the "NEW" button to restart the layout and THEN clear the frame with the same code:

    I get an error on the console (F12) that I cannot understand:

    From my tests the issue is related somehow to the Restart Layout Action.

    Why the action it supposed to do as #2 (above) having errors ?

    This is what I tried before posting in here:

    - I converted the key-press #2 (above) into a function, so I can call it but.. it's just a shortcut after all so I got the same error anyway.

    - If I disable the Restart Layout action (which is the all idea), it works fine!

    - I tried to change the order of the actions, but it didn't make any difference.

    Why does it happen and how can I fix this? (without pasting from BG_User to the Canvas)

    BONUS Note / Question:

    I must mention that I don't know ANOTHER WAY to RESET the layout beside using "Restart Layout" the action. If there is another way to do an absolute RESET to the specific layout (not ALL project) please let me know!

    BTW - I'm using NWjs as my final standalone execute, not actual browser if it makes any difference.

    Thanks ahead for any help!

  • When you restart the layout, at the end of the tick all objects will be destroyed and re-created. "Sprite Load from URL" action takes longer than that.

    Clear the image on start of the layout instead, if required.

  • When you restart the layout, at the end of the tick all objects will be destroyed and re-created. "Sprite Load from URL" action takes longer than that.

    Clear the image on start of the layout instead, if required.

    Ohhh I didn't know these facts, Now it works like a charm Thanks Sensei! :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)