JustinThomas Posted May 30, 2006 Report Share Posted May 30, 2006 Hi all, I have been following this forum for quite some time now. This is my first post though. I have a front panel with some string controls. I would like to restrict the user from entering some special characters in them. I would like to know if I can display him the tip strip programmatically whenever a special character is entered. I can show him a dialog box but its really annoying. I have seen a similiar behavior in Windows Explorer. I have attached a snapshot of the same to let you guys know what I am referring to. The picture shows balloons not tool strips I could do with those too. It would be great if I get some help on this. Justin Quote Link to comment
Guenther Posted May 30, 2006 Report Share Posted May 30, 2006 You can use a string indicator, which is usually hidden. If the user enters an illegal character, make this indicator visible and display the error message. To show the user which one is the offensive character, you can use the text.selection property on your string control to highlight it. The string control has to be in key focus for the highlighting to work. Good luck! Guenther Quote Link to comment
JustinThomas Posted May 30, 2006 Author Report Share Posted May 30, 2006 You can use a string indicator, which is usually hidden. If the user enters an illegal character, make this indicator visible and display the error message. To show the user which one is the offensive character, you can use the text.selection property on your string control to highlight it. The string control has to be in key focus for the highlighting to work. Good luck! Guenther Thats a neat way to do it. But I have around 10 to 12 of these string controls on my panel and it would be a lot of objects on the front panel if I keep an indicator for each to display the error message. Justin Quote Link to comment
crelf Posted May 30, 2006 Report Share Posted May 30, 2006 ...I have around 10 to 12 of these string controls on my panel... Use the event structure creativly - have a case that looks for a key down in all of the string controls, then the event case will return a control reference (through a node on the left of the structure) - pipe that into a property node and get the string out of the control and then use the above method from there... Quote Link to comment
Chris Davis Posted May 30, 2006 Report Share Posted May 30, 2006 Thats a neat way to do it. But I have around 10 to 12 of these string controls on my panel and it would be a lot of objects on the front panel if I keep an indicator for each to display the error message.Justin You shouldn't have to keep one error display per entry control, you should just need one error display string control for the whole front panel. You'll just have to change the position to the appropriate position for each control you want to display the error for. Monitor each of these controls in an event structure and search for any offending characters upon value change events and you should be set. :thumbup: Quote Link to comment
Neville D Posted May 30, 2006 Report Share Posted May 30, 2006 Hi all,I have been following this forum for quite some time now. This is my first post though. I have a front panel with some string controls. I would like to restrict the user from entering some special characters in them. I would like to know if I can display him the tip strip programmatically whenever a special character is entered. I can show him a dialog box but its really annoying. Justin Hi Justin, Use the event structure to find when a control is being updated, check the input string and then write your warning message to the property node>tip strip of the control. Keep checking with the event structure, to clear the tip strip (write an empty string to the tip strip property) when the user adjusts the input again. You know, this is the perfect use-case to implement an X-Control! then just propagate your X-control for the number of string controls you have on your panel. Neville. Quote Link to comment
crelf Posted May 30, 2006 Report Share Posted May 30, 2006 Here's a VI that does what I was tlaking about. That said, I don't think the tipstrip is what you're after, because you can't dynamically force it to pop up - the position and tracking of the mouse relative to the control does that for you... You might need to stick to a dialog box, or maybe create a dedicated VI that pops up next to your control (set its' window behaviour to "floating") - you can get the co-ordinates of the control as a property (just like the attached VI gets the text). Download File:post-181-1149006053.vi Quote Link to comment
Yair Posted May 30, 2006 Report Share Posted May 30, 2006 As an addition to emulating the windows explorer behavior, if you're using the Key Down event, you should consider using the Key Down? event instead and discarding all the clicks for the illegal characters. Quote Link to comment
crelf Posted May 30, 2006 Report Share Posted May 30, 2006 As an addition to emulating the windows explorer behavior, if you're using the Key Down event, you should consider using the Key Down? event instead and discarding all the clicks for the illegal characters. That's a really good point! Here's an example (you don't even need a tip strip - the user can't enter illegal characters): Download File:post-181-1149021477.vi Quote Link to comment
JustinThomas Posted May 31, 2006 Author Report Share Posted May 31, 2006 Hi all, Thanks for the prompt replies. I found the Event Discard method the easiest way to solve my problem. But would have loved to see a balloon tip, on a front panel object. Justin Quote Link to comment
Yair Posted May 31, 2006 Report Share Posted May 31, 2006 But would have loved to see a balloon tip, on a front panel object. Then just do something like the attached example. I copied the image from Word and used it to replace the frame of a string indicator. The balloon even appears near your control.Download File:post-1431-1149069054.vi Quote Link to comment
JustinThomas Posted May 31, 2006 Author Report Share Posted May 31, 2006 Thanks Yen, That was a good way of getting the balloon tips. Justin Quote Link to comment
crelf Posted May 31, 2006 Report Share Posted May 31, 2006 Then just do something like the attached example. Nice, very nice. :thumbup: 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.