lraynal Posted April 11, 2007 Report Share Posted April 11, 2007 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 Quote Link to comment
Tomi Maila Posted April 11, 2007 Report Share Posted April 11, 2007 If you are just trying to check if the control value is in the range and reset it so that it's in-range then there is another way to achieve this goal. Simply set the out of range action property. Tomi Quote Link to comment
lraynal Posted April 11, 2007 Author Report Share Posted April 11, 2007 That's the goal, but every line have different range... And this property is not available for a Table. Quote Link to comment
LAVA 1.0 Content Posted April 11, 2007 Report Share Posted April 11, 2007 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) 1 Quote Link to comment
lraynal Posted April 11, 2007 Author Report Share Posted April 11, 2007 Danke Martin! This property "Update while typing" (in english in the text!) is exactly what I'm looking for, but for a Table... and looks like it does not exist... unless someone here has a solution! "Viel spass" (have fun!), laurent Quote Link to comment
gleichman Posted April 11, 2007 Report Share Posted April 11, 2007 How about using the "key down?" event? Quote Link to comment
Grampa_of_Oliva_n_Eden Posted April 11, 2007 Report Share Posted April 11, 2007 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 Quote Link to comment
Guenther Posted April 12, 2007 Report Share Posted April 12, 2007 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 Quote Link to comment
Mellroth Posted April 12, 2007 Report Share Posted April 12, 2007 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 Quote Link to comment
Guenther Posted April 12, 2007 Report Share Posted April 12, 2007 QUOTE(JFM @ Apr 11 2007, 03:46 PM) 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 Yes, you're right. Backspace, delete, cursor movement etc. would have to be handled in different cases. The Scancode parameter gives you all necessary information to do that. But it's a bit more work. Did it once before I discovered the "Update while typing" property on a string control. I attach the program (LV8.20), one thing I didn't implement is when the user highlights some characters with the mouse and deletes them. But that could be added. Guenther http://forums.lavag.org/index.php?act=attach&type=post&id=5467''>http://forums.lavag.org/index.php?act=attach&type=post&id=5467'>http://forums.lavag.org/index.php?act=attach&type=post&id=5467 Quote Link to comment
TG Posted April 12, 2007 Report Share Posted April 12, 2007 Ben your a genius! I think I am going to try your idea out. I need to simulate typing into a cell just like that on a table. Hopefully it will be fun for me. LOL John Quote Link to comment
Adnan Posted April 13, 2007 Report Share Posted April 13, 2007 Here a possible implementatin of Ben idea. We could go further and have different editor for cells (numeric, checkbox, ring). I'm going to try to do an "AdvancedEditableTable" XControl as we could find in JAVA JTableCellEditor Quote Link to comment
Grampa_of_Oliva_n_Eden Posted April 13, 2007 Report Share Posted April 13, 2007 QUOTE(Adnan @ Apr 12 2007, 04:56 AM) Here a possible implementatin of Ben idea.We could go further and have different editor for cells (numeric, checkbox, ring). I'm going to try to do an "AdvancedEditableTable" XControl as we could find in JAVA http://www.javaworld.com/javaworld/javatips/jw-javatip102.html' target="_blank">JTableCellEditor Nice implementation Adnan! That coded up cleaner than I thought. Thank you! Ben Quote Link to comment
Grampa_of_Oliva_n_Eden Posted April 13, 2007 Report Share Posted April 13, 2007 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.