Jim Kring Posted March 25, 2015 Report Share Posted March 25, 2015 Anyone solved this problem? Basically, I want to get the screen coordinates of a block diagram object. Thanks! 1 Quote Link to comment
Yair Posted March 25, 2015 Report Share Posted March 25, 2015 I think the solution depends on exactly when you want to do this. The obvious answer is to get the BD window properties and work from there, but this has the equally obvious problem of figuring out the size of the top section of the window. This might be workable if you can add a step somewhere in the process where you do this once (and would need to redo it if something changed). A less obvious answer is that the panel has a method for this conversion. The BD doesn't have a parallel method, but since the top section appears to be the same size on both, it should be possible to place the FP window in the same position as the BD window and then use that method and return the FP window to its original spot. Probably as ugly as it sounds, but I expect it should work. Again, it probably depends on when you want to do this. Maybe this will be not as ugly if you create a temporary VI to do this and move it to the bottom of the window stack. 1 Quote Link to comment
hooovahh Posted March 25, 2015 Report Share Posted March 25, 2015 One thing that might help is you can hide the Menu and Button bar using a property node on the block diagram. I couldn't find one for removing the title bar, but I think that can be calculated. I think this is possible if there is a property to read the scrollbar position on the block diagram but I can't seem to find it. EDIT: Block Diagram Origin can give scrollbar position. I think this can be possible. 1 Quote Link to comment
hooovahh Posted March 25, 2015 Report Share Posted March 25, 2015 Okay attached is an example VI that I think does what you need. It will look for the screen coordinates to the Tick Count object on the block diagram. The only part I couldn't calculate is the width of the left edge of the window, and the height of the title bar of the window. Mine was 10px and 32px so I have them as controls but there is probably a way to figure out what this size is. Also I think we can assume the menu bar and debug buttons are always the same size so once this is determined once you won't need to recalculate it over and over. My code currently does this by removing these buttons then subtracting the difference in window size from when they were there. Get Object Position On Screen.vi 1 Quote Link to comment
Jim Kring Posted March 25, 2015 Author Report Share Posted March 25, 2015 Thanks for the quick ideas and examples. I'll do some testing to see how this works! This is for a fun little pet project that I'll be announcing and sharing with you guys soon Quote Link to comment
Popular Post ThomasGutzler Posted March 26, 2015 Popular Post Report Share Posted March 26, 2015 (edited) I've bookmarked this one a while back. https://decibel.ni.com/content/servlet/JiveServlet/previewBody/22385-102-3-42676/LabVIEW%20VI%20Dimensional%20Model.pdf Not sure if the same properties also apply to BD Edited March 26, 2015 by ThomasGutzler 3 Quote Link to comment
Yair Posted March 26, 2015 Report Share Posted March 26, 2015 I just realized that the panel's conversion method that I mentioned is actually more useful than I thought. You can use it once on first call to calc the window border (convert the top left point to the screen coords and subtract the window origin from it) and then cache that (LV has global data methods for caching) and use it for the BD window, because it should be the same numbers. That should be pure LV and should ideally work every time. P.S. You can probably do this calc on a temporary VI off screen or on any open VI, as long as it shows the window parts. Quote Link to comment
hooovahh Posted March 26, 2015 Report Share Posted March 26, 2015 I've bookmarked this one a while back. https://decibel.ni.com/content/servlet/JiveServlet/previewBody/22385-102-3-42676/LabVIEW%20VI%20Dimensional%20Model.pdf Not sure if the same properties also apply to BD That is a really neat document and I'm going to need to keep that in mind. These same properties don't apply to the block diagram, but as Yair mentioned many of them can help you calculate the size of objects that are shared on the FP and BD. Quote Link to comment
Popular Post Jim Kring Posted April 2, 2015 Author Popular Post Report Share Posted April 2, 2015 Hi Everyone. I wanted to share what I was working on. It's a new quickdrop plugin that adds delays into your code. Finding the screen coordinates of block diagram objects was important for "flying the fairy" to the right location on the screen. I've added you guys to the credits Thanks again for your help on this fun little project! 3 Quote Link to comment
hooovahh Posted April 2, 2015 Report Share Posted April 2, 2015 Very funny Jim, I smiles throughout the video, but I laughed at "ship it". Quote Link to comment
ThomasGutzler Posted April 6, 2015 Report Share Posted April 6, 2015 That's gold! 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.