LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically adjust object's position/size while resizing a labview window

Hi,

I tried to give you some clear pictures to clarify my why of thinking. Please have a look to enclosed documents.

Regards,

Daniele

Download All
0 Kudos
Message 11 of 24
(5,312 Views)

Hi,

I still hope to receive your comments. In the meantime I have changed my original "resize.vi" file in order to take into account that plot area sizes do not correspond to the actual bounds of a chart object. It seems to work much better now, with some additional adjustments. Still, as you could test, it does seem to have some not wanted behavior when window is first maximized and then reduced to a window again.

In addition I am wondering if exist a way to change sizes of a legenda and its fonts (programmatically) . What about string object. It seems that they can not be modified via the program itself, is that true?

Regards,

Daniele

0 Kudos
Message 12 of 24
(5,289 Views)
I'm sorry, but I don't have an answer for you. I took a look at your revised code, and my first impression was: "excessive". To do all of that just to deal with a resize event made me think about what's actually trying to be accomplished. I'm with Johannes on this. I don't understand why you expect your users to be making such window resizes that would cause so much trouble, including different screen resolutions. From my perspective, I follow the same mantra as "the customer isn't always right": the "user isn't always right". Sometimes the user has to be aware and concede to restrictions in how a program can (and should) be used. Does it really make any sense to shrink a font to the point where it's illegible? It is not my intent to discourage or belittle you (and please note I AM NOT doing that), and I'm sure you may have your reasons for trying to do this, but I can't really wrap my head around them, so I can't justify (in my mind) writing a whole bunch of code to do it.
0 Kudos
Message 13 of 24
(5,275 Views)

I am disappointed that you do not understand that, as a programmer, I try to have, as much as possible, under control all playing factors. My solution may appear a bit complicated but at least, with it, I can tweak, among other parameters, how much the fonts can be reduced/enlarged upon a window resize operation. So far, none of yours even tried to discuss the points I presented. I did not expect anybody to give a solution (a new program), but at least enter the topic without further discussing/asking about what are the benefit for users. I really would appreciate if you could stick to the open points I still have...

Regards,

Daniele    

Message 14 of 24
(5,257 Views)

daniz wrote:

I am disappointed ...I really would appreciate if you could stick to the open points I still have...

Regards,

Daniele    


Hi Daniele,

 

I looked at your last resize.vi and I liked what I saw.

 

Could you enumerate (for those of us that don't have time to disect the eveloution of this thread) what remaining issue your demo illustrates?

 

From what I can tell your demo works down to a certain size and then stops working. Is that the issue?

 

Sorry about asking a dumb question but there is a remote chance we can still help.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 15 of 24
(5,246 Views)

@daniz: You are, of course, entitled to your opinion, as I am in mine. One person can look at something and say "excessive", and another person can look at it and say "I like what I see". Does this mean that Ben is right and I'm not, or vice versa? Hardly. All that I was saying was that I can't really help you with this, yet you insist that I should be able to. I have no idea why - I simply do not see the problem in the same way. Perhaps it's because I was an electrical engineer before I became a programmer. Perhaps it's because I haven't encountered the same situations as you have. Or maybe I'm just a lousy programmer who puts up a good front. Whatever the case, I'm not here to judge or be judged. I'm glad to see that Ben is willing to take up the mantle of trying to help, and I sincerely hope that you can resolve this.

 

@Ben: Thank you for trying to help. 

Message 16 of 24
(5,239 Views)
From message 9, “...Anyway, the MinimumSize does not say how small the window can be before you see serious "distortions" …” . To this statement, although somebody try to suggest that the minimum size was a solution, no one even try to discuss further the subject. From message 12,  “…  Still, as you could test, it does seem to have some not wanted behavior when window is first maximized and then reduced to a window again.In addition I am wondering if exist a way to change sizes of a legenda and its fonts (programmatically) . What about string object. It seems that they can not be modified via the program itself, is that true?…”. Again no answer, so far.  Again something I do not understand is why objects in LV interface do show a sticky behavior ( see attached file, when you resize its window so that the scale-Legend overlaps the x-scrollbar then their position does not remain the same). Is that something that can be avoided.  
0 Kudos
Message 17 of 24
(5,213 Views)

Hi Daniele,

 

First things first.

 

Everyone who has replied to this thread are volunteers that are just trying to help out. We do not have all of the answers to every question, but we do try. That being said I will see what I can do to figure out what your concerns are. To do this I am going to cut-n-paste your reply such that I can process it (i'm ultra-dyslexic and my eyes cross if I don't have some blank lines to help out.)

 

 


1) 

From message 9,
“...Anyway, the MinimumSize does not say how small the window can be before you see serious "distortions" …” .
To this statement, although somebody try to suggest that the minimum size was a solution, no one even try to discuss further the subject. 
2)
From message 12,  
“…  Still, as you could test, it does seem to have some not wanted behavior when window is first maximized and then reduced to a window again
 
 3)
.In addition I am wondering if exist a way to change sizes of a legenda and its fonts (programmatically) .
 
4)
 What about string object. It seems that they can not be modified via the program itself, is that true?…”. Again no answer, so far.  
5)
Again something I do not understand is why objects in LV interface do show a sticky behavior ( see attached file, when you resize its window so that the scale-Legend overlaps the x-scrollbar then their position does not remain the same). Is that something that can be avoided.  

 


I think that breaks down into about 5 questions. As volunteers we generally don't have time durring the day to compose custom courseware so I am not supprised that those extra question went un-answered. I'd like to suggest you post each of those question sepearately so we can handle them one at a time. Now I have been nagged by some of the "up-and-comers" on this forum that indicate that I amy be answering too many questions and I'm not giving them a chance to contribute. WIth that in mind, any remaining Q's you have after I reply, should be posted a sepearte questions so that YOu get your answers and THEY get a chance to help you.

 

1)

I believe that suggest was made to help you utilize the solution you posted since your approach worked good right up until the pixel size became an issue. 

 

2)

See my PS below. That may help

 

3)

If you shut off the option "autoscale plot legend" you can programatically set its size. This is not trivial because the size of the fonts and the number of plots need to be taken into concideration. I don't think there is a way in LV 8.0 or above to control the font size of the legend. Anyone know how to set the font size of a legend? If this is critical to your app you will have to re-write the legend yourself using an array of clusters so you can control the required properties. Like I said this is not trivial.

 

4)

String sizes are limited by the font size. I have not done one of those but Id' first try setting the font smaller then try to down size the control. Somethingf that may help out with this challnge is in the Picture pallette there is a function that lets you insert text in a picture but also tells you how big the text rectangle will be and takes into concideration the font type and size.

 

5)

THat will take a little trouble-shooting but first I would make sure your algortihm is working right and all of teh postions and sizes are being set back the way they should be set. Discalimer: I am not ruling out the possiblility that your impresive resizing demo may have revealed a bug (or two). There some odd things I was when re-sizing the plot legend that may have been due to my quick hack or a bug.

 

 

Ben

 

PS: I noticed your FP object were above and to the left of the FP origin. After moving  to positive regions your code worked better, but not perfect.

 

Message Edited by Ben on 03-04-2009 10:53 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 18 of 24
(5,206 Views)

Daniele,

I understand your trouble.  I have wrestled with the problems with resizing windows in the past.

Unfortunately I cannot read your vi as I only have version 8.5 so I don't know what youre trying.

The key problems that I found are:

  • Many objects have a minimum size.  This means that shrinking the panel then increasing it again back to the original size makes things grow.
  • Every object has a different settable size parameter (or several).  The bounds parameter is read-only.
  • Not all parts of all objects are accessible programatically (particularly graph controls).
  • Some things scale nicely. Others don't.

My tips are:

  • Read all the object sizes and positions when the vi starts and scale everything from this and reset all sizes and positions when exiting. 
  • Use the bounds parameter to calculate how much the object needs to change by then change the settable size by this amount (but be careful not to go negative).
  • Disable the panel sizing during development - too much risk of shifting your carefully positioned controls.  At run-time you can always re-load the vi; during development you need to save.
  • Don't trust the bounds parameters given by the resize event - they may be out-of-date. Read the current panel size instead.
  • Don't resize when minimised.
  • When making a panel smaller, resize the child controls first.  When making it larger, resize the container first.
  • Free labels, lines and boxes can be accessed using the Panel.decorations[] property etc (but you don't know which are which).

 

Regards

Trevor

 

Message 19 of 24
(5,146 Views)

I will be back within next week. I have to think and work on last suggestions proposed by Ben and TrevMrgn

In particular I found interesting a comment about Decorations by TrevMrgn. With my following post I will give a LV8.5 compatible version of my sample resize.vi.

About you, Ben, I will try to show with a video the kind of problems (distortions) I am experiencing.

Regards,

Daniele

Message 20 of 24
(5,116 Views)