SAPHIR - Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

A few questions regarding Xtab docking/undocking

Hey, I stumbled across the Xtab package the other day and am very excited to start using it. I have a few questions regarding docking and undocking and closing of undocked windows.

 

My issue is that once a tab is undocked and opened in a new window, I can't find a way to intuitively add it back to the tab list. The simplest method is to close the undocked tab, then invoke AddPage in the PageClose user event to re-add the VI back to a new page. Unfortunately I can't distinguish between a PageClose on an undocked window versus a docked window, so when closing a docked tab it fires the same event, and readds the tab. Ideally what I'd like is to be able to distinguish between a closed *window* event and a closed *tab* event. Within the PageClose user event, since it fires *after* the page has closed (since LabVIEW can't have Filter user events AFAIK) I have to manually re-add the page, which is fine- but I don't know if the page was previously a part of the tab list or a part of a floating window.

 

I can, of course, have a button to redock windows, but that's not intuitive for users based on other tab-based programs. I can also implement a button within my subVI's that will send a "re-dock" request back to the main VI, but that couples my subVI's with the main VI, which is what I'm hoping to avoid when using this tab kit.

 

Another way to do it would be to manage a second list of "docked" versus "undocked" tabs within my main program, and compare the VI to the list of "docked" tabs within the PageClose user event; however, that's a second piece of data that will need to be managed alongside the tab interface. I'm trying to keep my main VI as decoupled as possible from my VI's displayed in the tabs.

 

It seems that all of this could be fixed by one of the following options:

1- having separate user events fire for either closing an undocked window or closing a docked window

2- having a value returned in the PageClose user event that says whether or not the VI was previously docked

3- add a value to the AddButton method to let me allow users to close windows but not tabs (so a Close event isn't generated by a user trying to close a tab; the tab close behavior could be done with a "Discard data" button or similar in my main UI).

 

Is there a better way to handle this? I'm very excited to use this in my new project but I'm just a bit stumped on how to handle re-docking. Thanks again for the awesome free toolkit.

0 Kudos
Message 1 of 3
(3,825 Views)

So I've been working with this for a few days trying to find a workaround to my issue (i.e., I want the Close button on a Window to re-add it to the tab list, but the Close button on a tab should actually close the tab, de-initialize the subpanel, etc.

 

Unfortunately I haven't found any workarounds to achieve the above. I tried some tricks with MouseDown events, but they only register on the tab control itself; not on any floating windows (as expected). I was hoping to use MouseDown to generate a list of which VI refs were in Tabs and which were in Windows but that doesn't work. Since MouseDown fires *before* the window is detached, it can't be used to tell whether a tab has just been detached.

 

Basically, it seems there's no way to programmatically find out when a window has been detached. If there was a way to do that, I could add that VI ref to a list of detached windows, and compare that VI within the Pane Close user event, and respond accordingly.

 

I also tried opening the source of the Xcontrol to see if I could add this functionality myself, but it appears all of those VI's are password protected, which is reasonable for a free toolkit.

 

For now I'm going to have to resort to a manual button to redock all floating tabs. While the whole tab kit thing is very cool, it doesn't mimic the behavior of other tab-based interfaces like Chrome or Firefox, where you can remove tabs and add them back later as needed.

 

Anyway, very cool resource and thanks for releasing it for free. Next time you guys do an update, please put this on the Requested Features list 🙂

0 Kudos
Message 2 of 3
(3,798 Views)

Hi,

 

A solution I found is to "Add a page"  when "PageClose" Event occur.

 

In the event structure the VIref is done (the one was closed), so it's easy to load the new page with the same VI (which is not kill by ClosePage event).

 

To make more smart, in event structure Timeout (100 ms), I am looking for page which are in windowed (GetAllVIRef method) and I configure each whith a true "close" propertie (each add page has a false close propertie).

 

Best regards

0 Kudos
Message 3 of 3
(2,784 Views)