Weird behavior of "...
 
Notifications
Clear all

Guests have read-only access to our forums. If you wish to participate you will need to register. Be sure to activate your account from the email sent to you when you register.

[Closed] Weird behavior of "IF" in common with "FONT-SIZE"

9 Posts
3 Users
0 Reactions
1,675 Views
(@markusmoench)
Eminent Member Registered
Joined: 5 years ago
Posts: 17
Topic starter  

Hello Glen,

I´m facing some strange behavior in case on the IF-Function, trying to set the FONT-SIZE.

code is:
#############################
font-size=8
# adjust fontsize and width according to screen resolution
MONITOR=set:dpi,hidden:1,display:%7
TEXT=display:dpi %dpi%

#if dpi is larger than 96 then
#IF=value1:%dpi%,value2:96,comp:gt
#font-size=16

comment=before_IF_in_common_with_FONT

IF=value1:33,value2:96,comp:eq
comment=first_IF_result_is_not_equal

IF=value1:33,value2:96,comp:eq
FONT-SIZE=16

IF=value1:33,value2:96,comp:eq
comment=third_IF_result_is_not_equal

#surface pro 4 has 168dpi
#font-size=16
#width=450
#############################

We would expect that all three IF are getting result FALSE and the commands in following line are not executed, right?
Result we get is:
comment #1 displayed with size 8
IF #1 correctly processed, no output
IF #2 font size set to value 16
IF #3 text "third_IF_result_is_not_equal" displayed in font size 16

tested on 2 different PC

Windowns 21h1
Desktopinfo v3.2.4.4142

best regards
Markus


   
(@rtruss)
Estimable Member Registered
Joined: 5 years ago
Posts: 77
 

I saw this and thought, this would be VERY helpful as I have many diff mfgs and of course potential dpi settings to contend with. I copied your code and notices that your IF statements do not do the compare correctly.

this code
MONITOR=set:dpi,hidden:1,display:%7
TEXT=display:dpi %dpi%
tells to set DPI, which if you look at it is not just a number but actually dpi 96. once I updated the IFs they seemed to process correctly from what I could tell.


   
(@markusmoench)
Eminent Member Registered
Joined: 5 years ago
Posts: 17
Topic starter  

Hello rtruss,
the three IF statements are comparing number 33 with 96 each - they are not tied to a variable in this example.
My issue is that the IF function is not working anymore after having "FONT-SIZE" in the executed line after.

I believe the %dpi% variable is always filled with just a number.


   
(@rtruss)
Estimable Member Registered
Joined: 5 years ago
Posts: 77
 

All i can tell you is that when i changed the comparisons to use 'dpi 96' vs just 96 they processed the comments. Now I had not yet had coffee 🙂 and was doing like 6 other things so I will revisit as I would like this to work as well.


   
(@rtruss)
Estimable Member Registered
Joined: 5 years ago
Posts: 77
 

I see what threw me off. tour text line, I didn't see the first dpi in there.


   
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1846
 

the FONT-SIZE lines are not items per se. Check the manual page 23. They are evaluated once during config load to set the default font size for the following items. Font size is not a dynamic thing. i suggest you put this section at the top of your config wrapped in BEGIN-ONLOAD / END-ONLOAD pair.


   
(@markusmoench)
Eminent Member Registered
Joined: 5 years ago
Posts: 17
Topic starter  

great, this was working. I did the code like this:

[items]
BEGIN-ONLOAD
FONT-SIZE=9
width=260
MONITOR=set:dpi,hidden:1,display:%7
IF=value1:%dpi%,value2:96,comp:gt
FONT-SIZE=16
IF=value1:%dpi%,value2:96,comp:gt
width=450
END-ONLOAD

thanks for your much appreciated support


   
(@rtruss)
Estimable Member Registered
Joined: 5 years ago
Posts: 77
 

will it re-evaluate that if there is a monitor change or if you hit the reload button? I am asking about the monitor change as we do use this on VDI units and if someone has multiple monitors that they can move the 'rdp' connection to that may affect the dpi.


   
(@markusmoench)
Eminent Member Registered
Joined: 5 years ago
Posts: 17
Topic starter  

yes, it will rescan the dpi and set accordingly within the BEGIN-ONLOAD group


   
Glenn's Page