Mark Zvilius Posted July 14, 2010 Report Share Posted July 14, 2010 I am working on an XControl whose Facade (front panel) is composed of standard LV numeric controls. I want to handle the "Direction Change" event simply by changing the numeric controls to indicators (or vice versa). Is it possible to get references to controls that are "hosted" by the XControl Facade VI? If so, I could simply set the Indicator property on each of them and be done. I tried creating references to the controls on the Facade front panel, but that didn't work. Makes sense because each instance of the XControl has its own instances of the numeric controls. I can use the Container State:Refnum item to get a reference to the XControl instance, but I don't know how to get references to the numeric controls from that. If that approach is a dead end, what other technique is available to accomplish the same thing? Thanks, Mark Zvilius Quote Link to comment
Francois Normandin Posted July 14, 2010 Report Share Posted July 14, 2010 I think it's a dead-end. Changing the appearence of your Facade controls isn't allowed programmatically at runtime (XControl is running when loaded on a front panel) so you'd get an error. However, you can use the "Direction Change" event in your XControl's Facade VI to show/hide controls and indicators. See this screencast I prepared. <object id="scPlayer" class="embeddedObject" width="1012" height="684" type="application/x-shockwave-flash" data="http://content.screencast.com/users/normandinf/folders/Jing/media/c3902d34-b2fd-40e3-a318-49a665849992/jingh264player.swf" > <param name="movie" value="http://content.screencast.com/users/normandinf/folders/Jing/media/c3902d34-b2fd-40e3-a318-49a665849992/jingh264player.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#FFFFFF" /> <param name="flashVars" value="thumb=http://content.screencast.com/users/normandinf/folders/Jing/media/c3902d34-b2fd-40e3-a318-49a665849992/FirstFrame.jpg&containerwidth=1012&containerheight=684&content=http://content.screencast.com/users/normandinf/folders/Jing/media/c3902d34-b2fd-40e3-a318-49a665849992/2010-07-14_1936.mp4&blurover=false" /> <param name="allowFullScreen" value="true" /> <param name="scale" value="showall" /> <param name="allowScriptAccess" value="always" /> <param name="base" value="http://content.screencast.com/users/normandinf/folders/Jing/media/c3902d34-b2fd-40e3-a318-49a665849992/" /> <video width="1012" height="684" controls="controls"><br /> <source src="http://content.screencast.com/users/normandinf/folders/Jing/media/c3902d34-b2fd-40e3-a318-49a665849992/2010-07-14_1936.mp4" type="video/mp4;" /><br /> <b>Your browser cannot play this video. <a href="http://www.screencast.com/handlers/redirect.ashx?target=viewingembededhelp">Learn how to fix this</a>.</b> </video> </object> Quote Link to comment
Mark Balla Posted July 15, 2010 Report Share Posted July 15, 2010 I want to handle the "Direction Change" event simply by changing the numeric controls to indicators (or vice versa). If that approach is a dead end, what other technique is available to accomplish the same thing? Thanks, Mark Zvilius It might help to not think in terms of indicators and controls. I know this idea has been drilled into our heads since we first started working in LabVIEW but X-controls are a different animal. Instead try and think of an X-control items as having 4 states Development time Input mode Development time Output mode Runtime Input mode Runtime Output mode The Facade defines how the x-control with look and act for each state. If we use a numeric control as an example Increment arrows shown, White background, Data entry allowed No increment arrows, Gray background, Data entry allowed Increment arrows shown, White background, Data entry allowed No increment arrows, Gray background, Data entry not allowed So instead of trying to force the numeric controls by hiding and showing them I would instead change a numeric control's properties depending on its current state. Show arrows, Color background white, Enable Hide arrows, color background gray, Enable Show arrows, Color background white, Enable Hide arrows, color background gray, Disable I have found this way of approaching X-control design much less aggravating. Mark 1 Quote Link to comment
jgcode Posted July 15, 2010 Report Share Posted July 15, 2010 So instead of trying to force the numeric controls by hiding and showing them I would instead change a numeric control's properties depending on its current state. I am under the assumption that both methods presented thus far are valid (depending on what you are trying to achieve/ how you like to program). Anyone care to list their thoughts on known pros and cons of each method from experience? Quote Link to comment
Francois Normandin Posted July 15, 2010 Report Share Posted July 15, 2010 I am under the assumption that both methods presented thus far are valid (depending on what you are trying to achieve/ how you like to program). Anyone care to list their thoughts on known pros and cons of each method from experience? I would have to say that I like Mark's idea better in the long run because you don't have to deal with managing the values of indicator and control when you switch. You surely don't want to have a control with value 0.000 and then switch to indicator and see 3.14159. Using only a control and playing with the disabled property and background color seems a much better avenue for XControl indeed. In fact, my tutorial was more about showing the "Direction Change" event and that's where you'd go anyway to implement this architecture instead. Quote Link to comment
Stagg54 Posted July 15, 2010 Report Share Posted July 15, 2010 I am under the assumption that both methods presented thus far are valid (depending on what you are trying to achieve/ how you like to program). Anyone care to list their thoughts on known pros and cons of each method from experience? How about a third? Why not a tab control? One tab for indicator. One tab for control. Quote Link to comment
Francois Normandin Posted July 15, 2010 Report Share Posted July 15, 2010 How about a third? Why not a tab control? One tab for indicator. One tab for control. You can do so much more with XControl. Quote Link to comment
shoneill Posted July 16, 2010 Report Share Posted July 16, 2010 I would have to say that I like Mark's idea better in the long run I agree also. I've only wandered into XControl territory a few times but I didn't like the way indicators and controls were duplicated in order to allow for both cases. I like the idea of using a single control and "manually" updating its appearance and behaviour to match an indicator. Seems more logical to me. Quote Link to comment
Mark Zvilius Posted July 16, 2010 Author Report Share Posted July 16, 2010 Thanks for the discussion. I agree that (the other) Mark's approach is cleaner than the dual control-indicator approach, which I had seen before but didn't want to mention in my original post .. because it seems such an awful kludge. Mark Z. 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.