From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Content Rect Position Property problem with listbox control: bizarre values returned

I am pulling my hair out with a little problem with ListBox Controls. I wrote a routine the hard way, to allow the user to click checkboxes in the listbox control, and my routine would toggle the checkmarks. To do this without using events (base package :((( ), I had to use global mouse coord values, combined with the 'point to row' method of the listbox. However, after a time, it stopped working, and the coordinates got fouled up such that I have to click somewhere OUTSIDE the listbox for the 'point to row' method to register a hit.

After some diagnosis, I've narrowed it down to a much simpler problem. The property 'Content Rect Position' for the list box is returning nonsensical values - as though it thinks the panel origin is actually somewhere further inside the panel (or that the control itself is somewhere else inside the panel)! I verified this by moving the whole panel to global screen position 0,0, compared it to my global mouse indicator, and looked at where it says the content rect position should be. It seems to be thinking that the panel origin is now somewhere WELL BELOW the menu bar, instead of just underneath it. Alternatively, it thinks it is up higher in the panel than it actually is!

This was working fine for weeks, but after making numerous edits yesterday, it stopped working. I tried deleting the listbox and creating a new one, but it has the exact same problem. I figure I must be missing something here??

Any help greatly appreciated. I was supposed to roll this software out tomorrow 😞

Cheers,
Avner Ginsburg
0 Kudos
Message 1 of 7
(2,848 Views)
UPDATE:

Inspiration hit just after entering the above message, however my problems aren't completely solved. The coordinate reference is apparently compared to the 0,0 grid position in the front panel EDITOR, and not the actual displayed window at runtime. So if I don't line that reference up exactly at the top left of the panel before saving, the coordinates are screwed up!

Is there any way to ensure that those two origins actually line up at run time? Or is there yet another property that returns the "point to row" but to the real, actual MS Windows origin?

I'm still confused as to why there is even a reference in the panel editor that does not match (necessarily) the actual window display origin while running, but hey... if someone can explain, that would be great.

Cheers,
Avner Ginsburg
0 Kudos
Message 2 of 7
(2,847 Views)
To make sure the panel coords are OK, simply wire a [0,0] cluster into the property when the program starts running.

___________________
Try to take over the world!
0 Kudos
Message 3 of 7
(2,841 Views)
Set 0,0 into which property? The list box -> Content Rect Position? Or the "point to row"? Or some other property of the panel itself? I'm guessing the panel origin is wrong, so it must be a panel property you are referring to?

Cheers!
Avner Ginsburg
0 Kudos
Message 4 of 7
(2,838 Views)
Yes, the FP.Origin property (or, if you have 8.x, whatever it's called if it's affected by the panes).

___________________
Try to take over the world!
0 Kudos
Message 5 of 7
(2,827 Views)

Be more specific about how to accomplish this.  I am working on using the point to row method, when you set the origin to 0,0 on the front panel, how does this work.  could you post some example code of how point to row method is used?

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 Kudos
Message 6 of 7
(2,368 Views)

The easiest way of using it is using the event structure and the Mouse Down event for the listbox, because it has a terminal which returns the coordinates of the click. The original poster didn't use that because they have LV base, which does not support editing events. Once you do that, you don't need to set the origin on the FP.


___________________
Try to take over the world!
0 Kudos
Message 7 of 7
(2,358 Views)