QControl Enthusiasts

cancel
Showing results for 
Search instead for 
Did you mean: 

DataGrid in a subpanel

Hi I'm playing with the datagrid QControl from here: https://gitlab.com/QSI_Shared_Code/SharedQControls/DataGrid which I think is "TheQ"'s own spin on it.

 

I have an issue in that if I use a datagrid in a subpanel, the "Edit" popups do not show in the correct place relative to the datagrid in the subpanel. It looks like it's coming from the way the screencoordinates of the selected cell are obtained from the active cell position. I think the "owningVI" reference use means that the 2nd conversion invoke node is using the front panel of the VI itself NOT the front panel as shown in the subpanel as the calculation reference... anyway anyone can think of of working around this?

 

Q-DataGrid-snippet.png

 


Thanks!

0 Kudos
Message 1 of 4
(1,775 Views)

Yes, I am aware of the problems you get with using subpanels while trying to convert to screen coordinates. I must have taken the easy way out and didn't make the correction necessary for those popups because it is not easy, especially if there are nested subpanels. This is due to the Panel to Screen Coordinates method not returning the correct values when in a subpanel (really wish NI would fix this). This goes for any time you work with subpanels and not just with QControls. 

 

Unfortunately, the only workaround is to either pass the subpanel reference to the QControl or to calculate the offset and pass that to it. The offset is the location of the subpanel (I think in screen coordinates but I might be wrong and panel coordinates are enough). As you can see, nesting subpanels compound this complexity because the offset must be calculated all the way down.

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 2 of 4
(1,759 Views)

From @psmorris on LinkedIn

 

I feel like one of the mgi panels toolkit position vis should mean you don't have to go to screen coords... But I couldn't find a way round it.

 

Thanks for the info, and the heads up that it gets more difficult with nested subpanels (which now I think about it this use case will involve!).

 

In my use case I actually only need a single column and it's the "list" datatype was most interested in... Is it possible to make a QControl that includes multiple controls? E.g. could you have a cluster that contains the multi-column listbox and then a combo box, a numeric, a string etc that are all hidden by default but that are then shown and positioned by reference as popups within the cluster? (In my case I could just use listbox and a combo box) That would mean you wouldn't need to worry about where to position a window? That was what I was going to try before I came across the datagrid and used that...

 

Yes the MGI Panel Manager does this same correction under the hood. I guess you could integrate your QControl with Panel Manager and use its windows position functions to help launch the popups.

 

The alternative is like you suggest and not have them be separate VI popups but rather invisible controls. I have implemented one this way before. I didn't do it this time because I wanted an OOP way to extend the data types that were supported.

 

There are basically two ways to control multiple controls in a QControl. The first is, as you suggest, by using a cluster. Take a look at my Calendar QControl for an example of this. The other way is to modify the constructor to have multiple inputs. I do this with my RichTextBox QControl where the constructor has a reference input for the String and another one for the Toolbar cluster.

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 3 of 4
(1,750 Views)

Funny enough, I had commented on this thread too. Someone else wrote a workaround for the screen coordinates. I haven't tested it but here is the link.

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 4 of 4
(1,740 Views)