Jump to content

Multi column listbox numeric control


Asotop

Recommended Posts

Hello.

 

I'm currently working on a bachelor assignment and I've encountered a problem.

 

post-50835-0-23838100-1393592969_thumb.j

 

As you can see by the picture the only column and i want to control is the "Control" column. Im sure of MCL is even the best solution to what im trying to achieve. In the code i've made a event handler, so i was atleast able to edit the items in the selected cell.

 

Would appreciate any help.

 

Regards Asotop

MCL test.vi

Edited by Asotop
Link to comment

As a note, clicking the stop button won't stop your VI until some other event occurs.

 

If I understand what you're trying to do, you want to cause any double-clicks on a row to edit the "Control" column? If that's the case, you can change the column of the cell position to always be the control column. There is a little more than that, so make sure to read the help for the Edit Position property.

Link to comment

Attached is what I think you want.  It has the close fix mentioned by Tim.  It also handles a close to stop as well.  Basically I added a Mouse Down? event and then discard the click if it was in a column other then the Control Value.  I still set the Value Signaling event so that when a row is clicked the value changes and gets the data from that set and does the string conversion you already had.  I also set the listbox to highlight the entire row.  Visually I like this better.  I also changed the data type back to a scalar because you only allowed them to select 1 item anyway.

MCL test Hooovahh Edit.vi

Link to comment

I changed the Window appearance first.  Hit CTRL + I or go to the VI Properties window, then I went to Window Appearance and selected Dialog, then hit customize and made the window non-modal (default), and allowed minimizing the window.  Then I colored the panel by bringing up the paint tool and selecting the System Color "Window" which is the system color that a normal Windows program will have as a background.

 

These steps help make the UI more Windows like.

Link to comment

Hey again. Almost done with the program now, the only problem now is that you have to click once in order to write the value and one more time to set it. If i click once and then write the value, and click at another row, the error handling will not execute.

 

What event should i chose in order to fix this?

 

Regards Asotop

Hydraulic Pressure units.vi

Edited by Asotop
Link to comment

I'm having some weirdness with the edit cell position selecting the 0,0 cell when it shouldn't so I won't upload what I have.  

 

But what you need to do is add an event to the event structure which is "Edit Cell?".  Here you can get the String which is the new string value of the cell you edit.  Then convert that to a number then back to a string.  This is a much simpler way of getting a valid number.  Then write that back to the String on the right side of the event structure.  In that case you should also fire another Value Signaling event causing the output values to be recalculated with the new value.

 

Also Decimal Digit? function takes a string, not a single char character.  You can use this to validate the input as well.

Link to comment

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.

×
×
  • Create New...

Important Information

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