LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

EVENT_PANEL_MINIMIZE

Hello,

 

I am very happy about the availability of the new EVENT_PANEL_MINIMIZE event - but I have a question / problem:

 

If I minimize the panel using the _ button in the upper right panel corner, the panel is minimized and the EVENT_PANEL_MINIMIZE event is triggered, as expected.

 

Now let's restore the panel: I do this by clicking on the taskbar button, and the panel gets restored as is the usual Windows behavior. Also, the EVENT_PANEL_RESTORE event is triggered, so far everything behaves as expected.

 

But now I click on the taskbar button again: The panel is minimized, according to the usual Windows behavior, but the EVENT_PANEL_MINIMIZE event is not triggered ?!  Smiley Surprised

 

Did I miss something? I would have expected that also in the latter case the EVENT_PANEL_MINIMIZE event is fired: the description says:

 

"When a user minimizes the panel to the taskbar, LabWindows/CVI generates an EVENT_PANEL_MINIMIZE event ..."

 

It does not say "When a user minimizes the panel using the _ button...."

 

0 Kudos
Message 1 of 7
(5,180 Views)

Hi Wolfgang,

 

The short answer is that what you're describing is the expected behavior (unfortunately).

 

The long answer is a bit messy, but I'll give it a shot.

 

In CVI, a taskbar button isn't always associated with a panel. By default, the button is actually associated with your application as a whole, and each panel's button is actually hidden. You can show/hide each panel's button by toggling the ATTR_HAS_TASKBAR_BUTTON panel attribute. You can also show/hide the application's button by toggling the ATTR_TASKBAR_BUTTON_VISIBLE system attribute. (Usually, these go hand in hand: you either show buttons for individual panel(s), or for the application as a whole).

 

When you minimize by clicking a panel's button in the taskbar (and this is equivalent to using the _ button in the upper right) the window is minimized, as expected. In this case, the event is sent.

 

When you minimize by clicking the application's button in the taskbar, the entire application is minimized, which causes all its windows to disappear. However, the individual windows have not been minimized by this action. If you were to call GetPanelAttribute with the ATTR_WINDOW_ZOOM attribute, it should report that it's not minimized. This is why you didn't receive an event.

When  you then click the button again, the application is restored and any individual panels which were visible before will again be visible, and any panels which had been minimized before, will still be minimized.

 

I admit that these effects is confusing and not very intuitive. This topic has come up before, in one shape or another, and it will probably continue coming up until some major redesign of the CVI window manager takes place (which will be risky and, therefore, not any time soon).

 

I also admit that this should have been included in the documentation for these events, and we'll fix this as soon as possible.

 

There are a few more wrinkles that come into play when your application has multiple panels visible at the same time. I'm going to avoid discussing these now, on the expectation that they might not apply to you (you can read about some of them in the thread I linked above). If you do only have one panel, you probably have any easy solution: turn off ATTR_TASKBAR_BUTTON_VISIBLE and turn on ATTR_HAS_TASKBAR_BUTTON. But if you have multiple panels and you're having a hard time making this work well, let me know and we can try to come up with a solution.

 

Luis

Message 2 of 7
(5,163 Views)

Dear Luis,

 

Thanks a lot for the answers, in particular the longer one 😉 I will need to think and play a bit for myself, so for now you'll receive just a big Thank you!

0 Kudos
Message 3 of 7
(5,158 Views)

Hi Luis,

 

I started with the simpler case of a one panel application. The reason why I didn't use your alternative solution:

 

    SetSystemAttribute ( ATTR_TASKBAR_BUTTON_VISIBLE, 0 );
    SetPanelAttribute ( panel_handle, ATTR_HAS_TASKBAR_BUTTON, 1 );

 

is a missing feature Smiley Frustrated The problem for me is that in this case the button text is always the panel title...! Usually the panel title is too long to fit on a taskbar button; hence I prefer to have a taskbar button text with the short name of the software, including its release, e.g. 'Soft 3.0', while the panel title deserves the full name of the software... So I would need a new panel attribute (and I am really hesitating to ask for yet another feature...)

 

    SetPanelAttribute ( panel_handle, ATTR_TASKBAR_BUTTON_TEXT, short_text );

 

Please, is there a workaround?

0 Kudos
Message 4 of 7
(5,152 Views)

@LuisG wrote:

 

When you minimize by clicking the application's button in the taskbar, the entire application is minimized, which causes all its windows to disappear. However, the individual windows have not been minimized by this action. If you were to call GetPanelAttribute with the ATTR_WINDOW_ZOOM attribute, it should report that it's not minimized.


I also have an application with many panels, one for each instrument, and in the past I found it cool / convenient to minimize all by clicking on the application button (although initially users were a bit confused that there is always one taskbar button too much...).

 

Actually, the request of a minimize event originated from this application. Unfortunately, your explanation means that the minimze event will not be useful for me in this case as I need to receive the event per panel.

 

Why isn't it possible that CVI sends a Minimize/Restore event from the taskbar button to all involved panels? (I understand the history of your window manager). I think this should resolve the issue and also would be a clean solution for one-panel-only applications...

 

What do you think?

 


 ... let me know and we can try to come up with a solution.


 Thanks... Smiley Wink

0 Kudos
Message 5 of 7
(5,147 Views)

Unfortunately, there's no good workaround for not being able to have a title for the panel's button that's different than the panel's title. I could be wrong, but I don't think Windows even allows that, so a ATTR_TASKBAR_BUTTON_TEXT that could work for panel's is not likely any time soon.

One (very) small piece of good news is that in Windows 7 there seems to be more room for displaying the title of the button than there was in XP. So, if your need for a shorter arose primarily from seeing how XP truncated it, that might become less important in Windows 7.

 

Concerning the Minimize/Restore event, yes, it would be possible to send it to all affected windows when the user minimizes the app button, but I think it would be wrong to do so. We shouldn't send you an event telling you that a panel has been minimized while, at the same time, telling you that the panel is not minimized if you then happen to call GetPanelAttribute with ATTR_WINDOW_ZOOM. Since the panel really isn't minimized (it's just hidden), it seems wrong to me to send the event.

The only conceivable workaround I can see is for us to send a new, EVENT_APPLICATION_MINIMIZE event, probably to the main callback.

 

Concerning your multi-panel application, have you looked into the ATTR_MINIMIZE_OTHER_PANELS attribute? Its purpose is to allow you to define one panel in a multi-panel application to be the "master" panel, such that when that panel is minimized, all other panels are also minimized, as a side-effect. This sounds like it might be the behavior you want for your multi-panel app, although I'm not really sure.

Of course, one important limitation is that this would only matter if you were willing to live with panel buttons with text matching the panel title...

 

Luis

Message 6 of 7
(5,138 Views)

Hi Luis,

 

I seized your suggestion of a new EVENT_APPLICATION_MINIMIZE event, here, hoping that it can be implemented 'soon'. You know, I was very happy to find my idea of an EVENT_PANEL_MINIMIZE implemented but then it is so much the more disappointing having to realize that it is insufficient to do what I had in mind... That's life, poor Sisyphus...

 

Thanks for pointing me to ATTR_MINIMIZE_OTHER_PANELS: I'll have to check it again, I forgot why I didn't use it then...

0 Kudos
Message 7 of 7
(5,132 Views)