Jump to content

Frame and labels underneath


MobileWill

Recommended Posts

I just started playing with the frame features and its awesome. I have one issue. I have some labels underneath that are updated once per second. The issue is once the frame window is open the updated label shows on top. Is there a way to set the frame as the top layer or do I have to handle not updating the labels underneath? Once I setup my graph the issue will be larger. Right now the label just over writes the top left corner.

I also noticed that once you close the frame it is destroyed and I have to created it again if needed. Is that the proper way to handle frames?

I am using a frame to bring up a settings window for the user to configure various options.

Thanks.

Link to comment
Share on other sites

You will need to stop updating the underlying widgets while the frame is visible as the ugfx window manager does not handle overlapping widgets except in a parent container/child relationship.

With regard to the destruction of the frame - I am currently thinking that that might be the incorrect action for the frame to take. Perhaps it should only automatically become invisible on the close button being pressed. What do the community think about this?

Link to comment
Share on other sites

I think this behavior should be customisable (when creating it), because two cases of using:

1. One or two frames with almost static content, or frames that used often - it is better not to destory them

2. Many frames with dynamic content, which can take all memory - it is better to destroy them after using

Link to comment
Share on other sites

I think this behavior should be customisable (when creating it), because two cases of using:

1. One or two frames with almost static content, or frames that used often - it is better not to destory them

2. Many frames with dynamic content, which can take all memory - it is better to destroy them after using

Good points. My case is a settings frame to set the date/time and eventually other things. So it might be accessed a lot vs another frame for SD card info. If the frame is not destroyed would it retained the selected list items?

Link to comment
Share on other sites

Yes. If it is not destroyed then the contents of list boxes etc will be retained.

It should probably be easy enough for us to add a new flag to the existing flags in the create call to control whether it gets hidden or destroyed on closure.

The default would be destruction in order to match existing behaviour of the frame and setting the new flag would change the behaviour to hide it instead.

Link to comment
Share on other sites

The new flag GWIN_FRAME_KEEPONCLOSE will now prevent destruction of the frame when the close button is pressed.

Note that this flag does not hide the frame - the user application will need to trap the CLOSE event and manually set the frame to invisible. The flag just prevents the frame window from being destroyed.

This is now in the repository.

Link to comment
Share on other sites

The new flag GWIN_FRAME_KEEPONCLOSE will now prevent destruction of the frame when the close button is pressed.

Great!

I have some labels underneath that are updated once per second. The issue is once the frame window is open the updated label shows on top. Is there a way to set the frame as the top layer or do I have to handle not updating the labels underneath? Once I setup my graph the issue will be larger. Right now the label just over writes the top left corner.

As inmarket mentioned the default window manager that comes with the uGFX library doesn't handle overlapping widgets unless they are in a parent/child relation ship (containers). This is one of the limitations the window manager has but in return it is a very small and fast window manager that only uses very little resources.

However, if you have more complex needs that's no problem: The GWIN API allows to use a different window manager. You can write your own window manager that properly supports overlapping widgets and use that one instead of the default built-in one by calling gwinSetWindowManager().

Writing your own window manager is not as difficult and complex as it might sound at first. So if you would like to have a go on that feel free to use the current one as an example/reference. We are also happy to help wherever we can.

~ Tectu

Link to comment
Share on other sites

The frame widget sends the following event when it gets closed: GEVENT_GWIN_CLOSE

So in your event loop, just listen for that event as you do for any other event (button press, slider value change, ...) and you should be good.

The overlapping that containers manage is the overlapping between the parent and the child, not between individual children. So everything mentioned about the window manager above still is the case.

~ Tectu

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...