Jump to content
Sign in to follow this  
Pollux

Custom Multicolomn Listbox Control

Recommended Posts

I am doing a data fitting program and I need to design a custom table control which should contain on the firs row an array of strings, on the second row an array of numeric controls and on the third row it should be an array of numeric indicators.

Right now I am using a Multicolumn Listbox as in the image below, doing string to number conversion when I need to get data from the second row and number to string conversion when I am writing data o the third row.

I think this is memory and time inefficient and it could crash the program at runtime if the users accidentally types some letters instead of numbers in the second row.

post-10966-1227174630.jpg?width=400

My original idea was to customize a Multicolomn Listbox but I have read the chapter about Typedefs and Custom Controls in the book LabView for Everyone, and it says there that you can't change the behavior of a control, only its aspect.

I would like to know if there is a solution to my problem.

Thank You

Share this post


Link to post
Share on other sites

Well, I would make the listbox an indicator, with no customizing. Then detect a mouse-click event over the second row, position an invisible numeric control over the selected cell and make it visible, so the user can enter a number. Detect the value change event, convert it to string and put it in the listbox. Iy's easy and avoids the possibility of entering a text instead a number. But surely there are many other approaches.

Saludos,

Aitor

Share this post


Link to post
Share on other sites

Another alternative is simply to create a 1D array of clusters, where the first cluster element would be a string and the other two would be numerics. You can make the third an "indicator" by changing its enabled state to disabled (1). You won't be able to get it to look exactly like the table, but you can get pretty close by coloring things transparent.

Share this post


Link to post
Share on other sites

@Aistor_Solar: Your proposed solution might look very impressive, but I'm not sure how would I interchept the event for the mouse being over the second row of the multicolumn listbox. If I have the time I will try to find a way to code this.

Yair, normandinf: This is the solution I will use because I like the look and is very simple to use it in my diagram (wich is almost done).

Salut─âri,

Pollux

Share this post


Link to post
Share on other sites

QUOTE (Pollux @ Nov 20 2008, 04:55 PM)

@Aistor_Solar: Your proposed solution might look very impressive, but I'm not sure how would I interchept the event for the mouse being over the second row of the multicolumn listbox. If I have the time I will try to find a way to code this.

Yair, normandinf: This is the solution I will use because I like the look and is very simple to use it in my diagram (wich is almost done).

You don't usually change the cell when the user hovers over the cell but only when he clicks in a cell. That is fairly easy to do with the event structure and a mouse click event. Calculate the cell number from the mouse click position, make a numeric control visible and place it there in the right size and then you are more or less set.

Personally I have used the array of clusters in the past too for such cases though :)

Rolf Kalbermatter

Share this post


Link to post
Share on other sites

QUOTE (erchaj @ Jan 9 2009, 01:56 PM)

Let say I use the 1D array of clusters.

How could I know which cell the user click if I use a scrollbar?

Thanks

There is a "Point to Row Column" method (invoke node) that you can use.

Share this post


Link to post
Share on other sites

Thanks for your answer.

Now I know which index the user click but how could I know which item in the cluster the user click.

As I see the array have to be initialize before your solution works.

Eric

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.