Container Control - Open Event

  1. 4 weeks ago

    Dave S

    Nov 13 San Diego, California USA
    Edited 4 weeks ago

    I created a custom control using a Container Control to hold all the bits.
    To the CC I added Open and Resize events....
    The Resize event is called as desired... but the Open event is NEVER called.... I even put breakpoints to be sure.
    If I add an Activate event.. it is called, but not the Open.....

    Constructor method is called,, so maybe I will use that unless someone can tell me I did something wrong :(

    hanging head in shame...... found it

    As mentioned this custom control has 3 canvas on it..... turns out in the paint event for one of them it based its drawing logic on the current character width.... well that width had not been established (timing issue) so there was a "FOR X=a to b step 0"

  2. Joost R

    Nov 13 Pre-Release Testers, Xojo Pro The Netherlands

    As a workarround you could use the Contructor to raise you own open event.

  3. Dave S

    Nov 13 San Diego, California USA

    I tried that... and all of a sudden the app just crashes..... not related to Constructor , or I think it isn't

    so now I have to figure out the crash before I can readdress this..... and everything WAS working so well :(

  4. Beatrix W

    Nov 13 Pre-Release Testers Europe (Germany)

    You must be doing something weird. Of course, the open even of containers fire.

  5. Dave S

    Nov 13 San Diego, California USA

    @Beatrix W You must be doing something weird

    That goes with out saying :)

    I *think* it has something to do with the computed properties .... since all those get called BEFORE the open event even

  6. Beatrix W

    Nov 13 Pre-Release Testers Europe (Germany)

    I did something similar last week. App started crashing when closing the database. Stupid me had added a disconnect and then the app talked to the database again. Took me quite a while to understand what I had done.

  7. Dave S

    Nov 14 San Diego, California USA

    a few of the computed properties were told to invalidate a canvas.... which wasn't ready yet.

    Why it just "skipped" the Open event instead of raising an error I do not know

  8. Bob K

    Nov 14 Pre-Release Testers, Xojo Pro Kansas City

    If memory serves (and it doesn't always), the Open event is the *last* thing that fires indicating that everything is done and ready for business. In the open event set a boolean variable for Initialized and in your computed properties you might want do a check that variable before sending commands to controls.

  9. Dave S

    Nov 14 San Diego, California USA

    @Bob K If memory serves (and it doesn't always), the Open event is the *last* thing that fires indicating that everything is done and ready for business. In the open event set a boolean variable for Initialized and in your computed properties you might want do a check that variable before sending commands to controls.

    Yeah that is what I'm working on right now..... something I just changed has it going into an infinite loop.... if it isn't one issue its another .... :)

    And it has to be something with the Computed Properties... as I have found it is skipping the Open events of all the controls that are INSIDE the CC as well.

  10. Bob K

    Nov 14 Pre-Release Testers, Xojo Pro Kansas City

    Subclassed container or just straight container?

  11. Dave S

    Nov 14 San Diego, California USA

    @Bob K straight container

  12. Bob K

    Nov 14 Pre-Release Testers, Xojo Pro Kansas City

    Huh. I'm out of guesses.

  13. Dave S

    Nov 14 San Diego, California USA

    I put log messages into every event and method...... and it shows that all the CP are activated..... but then nothing.... it doesn't log anything past that.... :(

  14. Bob K

    Nov 14 Pre-Release Testers, Xojo Pro Kansas City

    Break it out into a smaller project to see if it's something specific to the larger one?

  15. Dave S

    Nov 14 San Diego, California USA

    @Bob K Break it out into a smaller project to see if it's something specific to the larger one?

    Ironically this isn't a large project by any means....

    Its a window and this one CC with a Textarea , 3 canvas and a Label

  16. Jon O

    Nov 14 Pre-Release Testers, Xojo Pro Chicago Area USA

    I have seen this where a Container's open event never fires. I know I've seen it in WebContainers, but I think in Desktop as well. I believe I may have an open bug report on this - I'll have to look.

    Question: Are you placing the container in the window or are you creating the container and using EmbedWithin

    I think that placing it in the window in the IDE is problematic. I now embed my containers in code 100% of the time. In those cases, the open event seems to fire reliably.

  17. Tim P

    Nov 14 Pre-Release Testers feedback://46303

    @Dave S Ironically this isn't a large project by any means....

    Its a window and this one CC with a Textarea , 3 canvas and a Label

    Is it small enough to share with us then? I'm curious

  18. Dave S

    Nov 14 San Diego, California USA

    @Jon O Are you placing the container in the window

    the Container is the basis for a custom control... one that needs to ultmatly be used over and over again

    @Tim P Is it small enough to share with us then? I'm curious

    I'd rather not quite yet.... if I get it working, it will be a simple alternative to CEF, FTC etc.

  19. Jon O

    Nov 14 Pre-Release Testers, Xojo Pro Chicago Area USA

    @Dave S the Container is the basis for a custom control... one that needs to ultmatly be used over and over again.

    OK. So you are embedding it. That's strange. Check for some sort of exception in the Constructor or in one of the controls in the container. I've seen that which then aborts the constructor code from running and the Open event never gets called.

  20. Newer ›

or Sign Up to reply!