maillist@pvxplus.com

Message: previous - next
Month: April 2015

RE: [Pvx] screen sizing

From: "Marty Becker" <marty@...>
Date: Thu, 9 Apr 2015 12:31:56 -0400
Eric,

	Thank you !

	That worked perfectly.

Marty

-----Original Message-----
From: Eric Vanpaeschen [EDIAS Support] [mailto:eric.edias@...] 
Sent: Thursday, April 9, 2015 4:33 AM
To: maillist@...
Subject: Re: [Pvx] screen sizing

Marty,


I assume you will need to force the Nomads window resize logic to be
executed after 
changing the screen size:

perform "*winproc.rsz;Resize"


Regards,

Eric Vanpaeschen
EDIAS Support

-----Original Message----- 
From: Marty Becker
Sent: Tuesday, April 07, 2015 7:16 PM
To: maillist@...
Subject: RE: [Pvx] screen sizing

Eric,

I've been playing with this code and it works great !

Thanks !

Now when I do this with a running gui program I get an err=29 in
*winproc. I'm guessing the font got larger but not the screen.

Is there a way to fix this ?

Marty

-----Original Message-----
From: Eric Vanpaeschen [EDIAS Support] [mailto:eric.edias@...]
Sent: Thursday, January 8, 2015 8:16 AM
To: maillist@...
Subject: Re: [Pvx] screen sizing

Marty,


Are you asking if there's a way to calculate the MS Windows font size
for
the active textfont so that '100%' results in a PxPlus window that's
fullscreen (or should I say full desktop) and '50%' results in a PxPlus
window that's only a quarter of the size of the desktop ?

If so, the answer is: no, that's probably impossible, due to the fact
that
the font width and height don't size in the same way.  Here's the best I
can
do:

0010 PRINT 'DIALOGUE'(0,5,80,25,"Test"),'SR','CS', ! The test window
0020 ! Get current font & extract current size
0030 LET ERROR$="",STD$=FIN(0,"STDFONT"),P=POS(","=STD$,-1)
0040 IF P=0 THEN LET ERROR$="No current size found"; GOTO DONE
0050 LET SIZE$=STD$(P+1),FONT$=STD$(1,P)
0060 ! Check if suitable font (allows all sizes)
0070 LET F$='FONT'(LIST FONT$(1,LEN(FONT$)-1)),F$=F$(1,LEN(F$)-1)
0080 LET FIRST=POS(","=F$),LAST=POS(","=F$,-1)
0090 IF FIRST=0 OR LAST=0 THEN LET ERROR$="Unsuitable font"; GOTO DONE
0100 LET LAST=NUM(F$(LAST+1)),FIRST=NUM(F$(1,FIRST-1))
0110 IF POS(","=F$,1,0)<>LAST-FIRST THEN LET ERROR$="Unsuitable font";
GOTO
DONE
0120 ! Calculate pixel size of current window
0130 LET M$=MSE,XW=ASC(M$(10)),YW=ASC(M$(11))
0140 LET O$=OBJ(0),COLS=DEC(O$(33,2)),LINES=DEC(O$(35,2))
0150 LET XPIX=XW*COLS,YPIX=YW*LINES ! Window size in pixels (excl
border)
0160 LET WINX=DEC(M$(27,2)),WINY=DEC(M$(29,2)) ! Desktop pixel size
0170 ! *or* get the window pixelwidth from OBJ() (replaces previous
routine)
0180 LET O$=OBJ(0),XPIX=DEC(O$(25,2))
0190 ! CurPCT will be percentage based on horizontal width
0200 LET CURPRC=PRC; PRECISION 8; LET
CURPCT=100*XPIX/WINX,PCT=INT(CURPCT+.5)
0210 !
0220 WHILE 1
0230 INPUT (0,ERR=*SAME)"Current % is "+STR(PCT)+" - enter new % : ",PCT
0240 IF PCT=0 OR CTL=4 THEN BREAK
0250 IF PCT<10 OR PCT>150 THEN PRINT "Less than 10% or more than 150%";
CONTINUE
0260 LET SIZE=NUM(SIZE$)*PCT/CURPCT,ADD=0
0270 TRYADD: LET NEW$=FONT$+STR(INT(SIZE)+ADD)
0280 PRINT 'OPTION'("StdFont",NEW$),'DF',
0290 ! Routine to guarantee a perfect fit
0300 LET O$=OBJ(0),XPIX=DEC(O$(25,2))
0310 PRINT STR(INT(SIZE)+ADD),":
",STR(XPIX),"<>",STR(INT(WINX*PCT/100)),DIM(4), ! Debugging code -
should be
removed
0320 IF XPIX<=INT(WINX*PCT/100) THEN LET ADD-=1; GOTO TRYADD
0330 ! End of 'perfect fit' routine
0340 PRINT 'OPTION'("StdFont",FONT$+STR(INT(SIZE)+ADD+1)),'DF',
0350 LET O$=OBJ(0),XPIX=DEC(O$(25,2)) ! Debugging code - should be
removed
0360 PRINT STR(INT(SIZE)+ADD+1),":
",STR(XPIX),"<>",STR(INT(WINX*PCT/100)),DIM(4) ! Debugging code - should
be
removed
0370 WEND ; PRECISION CURPRC
0380 !
0390 DONE:PRINT (0,ERR=*NEXT)'OPTION'("StdFont",STD$),'DF','POP',
0400 IF ERROR$ THEN PRINT ERROR$; LET ERROR$=""

All calculations are based upon the WIDTH of the window, not the height
(so
that will probably be way off).  The 'perfect fit' routine will try the
next
larger font when it determines that the size is too small, and will end
up
with a font size that's 1 less than the font size that was too big to
fit.
During my tests with 'Lucida Sans Typewriter', the 'perfect fit' routine

always ended up with the font size I calculated in the 1st place.


Regards,

Eric Vanpaeschen
EDIAS Support

-----Original Message----- 
From: Marty Becker
Sent: Monday, January 05, 2015 7:03 PM
To: maillist@...
Subject: [Pvx] screen sizing



Folks,



              We currently allow users to size the relative size (I'm
not
sure this is the right way to express this) the screen by picking a font

size. We then set the text plane to this size - i.e.:



              FONT$="Lucida Console,-18"

              PRINT 'OPTION'("STDFONT",FONT$),'DF',



              We have found that this is a confusing unit of measure for
our
end users. I would like to allow them to select a percentage of the
screen
say 20.00 - 100.



              Now I need to calculate a font size that matches a % of
the
screen size. I have no idea how to do this. I can get the screen size
from
the MSE variable and the standard character width & height. How do I
calculate a font size or some other way to change the screen size for
that
data ?



Pvx+ 1201



Marty 



---------------------------------------------------------------------
To unsubscribe, e-mail: maillist-unsubscribe@...
For additional commands, e-mail: maillist-help@...