Jump to content

Custom Multicolomn Listbox Control


Pollux

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

Link to comment

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

Link to comment

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.

Link to comment

@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

Link to comment
  • 2 weeks later...

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

Link to comment
  • 1 month later...

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...

Important Information

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