hooovahh Posted March 25, 2015 Report Share Posted March 25, 2015 So lets say I have a Multicolumn Listbox. In this MCLB one of the cells isn't intended to contain text, but instead to just allow the user to set the background color of the cell. So the user clicks on the cell, and I will move a frameless color box control to be under the mouse, then I'll invoke a mouse click so the color selection box comes up. This all works well enough. It would work better if there were a property node for opening a color box but that's a different post. Now lets say the user doesn't pick a color, and instead when the color selection window comes up, the user clicks on another cell of the table. This mouse click will not behave like you would expect. If you click on a control the mouse down event won't be triggered. I'm guessing this is because the mouse down isn't registered, and instead the dismissal of the color box is seen. So what I'd like to do is perform another mouse click after the dismiss so it works like it normally would where the first click dismisses the color selection, and the second then clicks on whatever the user intended to. But the problem is how do I detect a dismissal of a color box control? Enums luckily have a "Operate Menu Dismissed" event that can be generated (with super secret stuff) but the color box doesn't have an equivalent event. So what's a good way to allow a user to select a color and have more control over this? Should I just resort to making a separate VI that floats that I can have more control over? Anyone make an XControl for color selection? Quote Link to comment
mje Posted March 26, 2015 Report Share Posted March 26, 2015 I've done this exact thing, but I used a system call to display the OS color dialog. Pretty sure it handled the case you describe. If this is an option for you I can dig up the utility VI I wrote. It's for Windows, though I can't recall if it used the Win32 or .NET API. Quote Link to comment
hooovahh Posted March 26, 2015 Author Report Share Posted March 26, 2015 This is a viable option for me, would you mind posting it? I found some .NET color selection VIs on the darkside but I couldn't get them to work for some reason and just moved on. Quote Link to comment
Popular Post mje Posted March 26, 2015 Popular Post Report Share Posted March 26, 2015 Here you go. It's not quite a drop-in from what you describe. The system dialog is modal and I believe it centers on screen, opposed to the LabVIEW color picker which can be made appear more like a context menu. The modality likely helps though since dismissal is automatically handled. Hope it helps. m Edit: this source code is released to the public domain, blah blah blah. .NET Color Picker 2013.vi 3 Quote Link to comment
hooovahh Posted March 26, 2015 Author Report Share Posted March 26, 2015 Oh neat thanks this is very helpful. Quote Link to comment
Yair Posted March 26, 2015 Report Share Posted March 26, 2015 Another option is basically grabbing the image off of the LV color picker and using that as your source. I posted an example here - http://forums.ni.com/t5/LabVIEW/Using-LabView-s-Color-Picker/m-p/576129#M270051 1 Quote Link to comment
eberaud Posted March 26, 2015 Report Share Posted March 26, 2015 2 different and equally nice solutions. Thanks for posting them! 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.