Jump to content

Event "Value change" during the change and not at the end...


Recommended Posts

Dear LAVA masters,

I need to capture the change of a value (let's say a cell in a table, but it could be a string as well...) during the change...

I mean, I can't wait for the end of the change to get the "change event". When I change the value, I want to be able to see the modification and do some actions.

I can get an event during the modification, with "key down" (or up), but then, the value is still the one at the start of the change, not the one actually displayed!

http://forums.lavag.org/index.php?act=attach&type=post&id=5450

If you look at this example, I'm changing the line 4. I'm getting correctly the event, but the value I get is still '0'... (not '99999')

Is there a way to obtain the new value during the change?

Note: I'm under LabVIEW 7.1.1

Thank you all for taking care of young apprentice!!!

laurent

Link to comment

QUOTE(lraynal @ Apr 10 2007, 03:08 PM)

Dear LAVA masters,

I need to capture the change of a value (let's say a cell in a table, but it could be a string as well...) during the change...

I mean, I can't wait for the end of the change to get the "change event". When I change the value, I want to be able to see the modification and do some actions.

I can get an event during the modification, with "key down" (or up), but then, the value is still the one at the start of the change, not the one actually displayed!

http://forums.lavag.org/index.php?act=attach&type=post&id=5450''>http://forums.lavag.org/index.php?act=attach&type=post&id=5450'>http://forums.lavag.org/index.php?act=attach&type=post&id=5450

If you look at this example, I'm changing the line 4. I'm getting correctly the event, but the value I get is still '0'... (not '99999')

Is there a way to obtain the new value during the change?

Note: I'm under LabVIEW 7.1.1

Thank you all for taking care of young apprentice!!!

laurent

If you use a string control, then you can detect changes while someone still enters the text...

just activate the property for the string control "Wert beim schreiben einlesen" (German LabVIEW) but it's someting similar in other languages...

(also works with a string array)

  • Like 1
Link to comment

Here is a method that may help you (warning this is more complicated than setting a property).

Watch for mouse downs on the table.

When detected, convert the mouse coordinates to cell row and collum.

Determine size and postion of the "selected cell" and set a previously off screen string control to visable and size it and postition it over the selected cell.

Fill in the text box with the contnets of the selected cell.

Set key focus on the text box (which should now be over-lapping the ceel they clicked on).

Watch the key strokes as long as the text box has foucus.

When focus is lost copy the text box contents into the cell and then hide the text box off screen.

This should work since I the table itself actually uses a motehod similar to this but uses a picture control instead of a table.

have fun!

Ben

Link to comment

The key down event is the correct one, but instead of reading the table value you should capture the key itself and add up the consecutive keystrokes in a string indicator. In this string indicator you'll always have the current value of the table cell.

To reset the value you can use the "value change" event, this means the user hit enter or clicked into another cell.

I only have LV8.20, so a screenshot will have to do.

Good luck

Guenther

http://forums.lavag.org/index.php?act=attach&type=post&id=5466

Link to comment

QUOTE(Guenther @ Apr 11 2007, 03:27 PM)

The key down event is the correct one, but instead of reading the table value you should capture the key itself and add up the consecutive keystrokes in a string indicator. In this string indicator you'll always have the current value of the table cell.

To reset the value you can use the "value change" event, this means the user hit enter or clicked into another cell.

This will only work as long as the user presses alpha-numeric keys on the keyboard.

If the user presses backspace, delete etc., the resulting string would be different than the actual cell value.

Ben's method would take care of all this, and also if the user moves the cursor with a mouse click and start editing inside the sting instead of at the end.

/J

Link to comment

QUOTE(Ben @ Apr 12 2007, 08:20 AM)

Nice implementation Adnan!

That coded up cleaner than I thought.

Thank you!

Ben

Let me be the fisrt to point out an issue with my approach.

I belive the proper term is "desenders" (those parts of a character that drop below the line).

eg

If we are typing a "y" the decender is not visable so it looks like we typed a "v". Bumping the height by one pixel partially masks the issue but there is also a slight shift in the data when the data is entered.

If these two issues are of concern, then a picture indicator may have to be the "displayed object" so that we do not loose the decenders.

Ben

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.