Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread setting the zoom for a window
Tue, Nov 7 2017 7:10 AMPermanent Link

erickengelke

Avatar

I'd like to set the CSS3 zoom attribute for a window to 80% in EWB/Javascript.   I haven't quite figured out how to set that yet.  

Erick
http://www.erickengelke.com
Tue, Nov 7 2017 11:44 AMPermanent Link

Matthew Jones

erickengelke wrote:

> CSS3 zoom attribute

Hmm, a quick search says that is an old method from IE6 days and there are better ways. What are you trying to do anyway?

--

Matthew Jones
Tue, Nov 7 2017 12:48 PMPermanent Link

erickengelke

Avatar

"Matthew Jones" wrote:

> erickengelke wrote:
> CSS3 zoom attribute

Should be opposite.  Old IE doesn't support CSS3, zoom CSS is recommended by some as modern.


>Hmm, a quick search says that is an old method from IE6 days and there are better ways.

I've got forms with grids or other objects laid out as I want them - these are big tables and I don't have
permission to change that format.

Some users are using Ctrl-minus to fit the whole grid nicely on the screen.  So I would like to make
a button which resizes the whole display to fit in the visible space.  I can mathemtically figure out
what Zoom I need (usually about 85%), and would like to set that zoom level.

Erick
http://www.erickengelke.com
Wed, Nov 8 2017 11:08 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Erick,

<< I'd like to set the CSS3 zoom attribute for a window to 80% in EWB/Javascript.   I haven't quite figured out how to set that yet. >>

I really wouldn't recommend doing what you're trying to do.  Using transformation/scaling will not work very cleanly relative to other elements in the application, and anything else is non-standard.

My recommendation is: if you want to make something bigger, just make the fonts, etc. bigger.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Nov 8 2017 6:53 PMPermanent Link

erickengelke

Avatar

Tim Young [Elevate Software] wrote:

Erick,

<< I'd like to set the CSS3 zoom attribute for a window to 80% in EWB/Javascript.   I haven't quite figured out how to set that yet. >>

>I really wouldn't recommend doing what you're trying to do.  Using transformation/scaling will not work very cleanly >relative to other elements in the application, and anything else is non-standard.

> My recommendation is: if you want to make something bigger, just make the fonts, etc. bigger.

I agree, that's the best way to do it.

However it would be complicated because the project had a lot of complicated forms, redoing all the controls, fonts, etc. would have been a fair bit of work to resize everything, even if I automated it in a loop.

For the quick and dirty 3-line solution I put in a transform and it looks good and works on every non-Microsoft browser.  

Erick
http://www.erickengelke.com
Wed, Nov 8 2017 11:12 PMPermanent Link

erickengelke

Avatar

erickengelke wrote:

<< I'd like to set the CSS3 zoom attribute for a window to 80% in EWB/Javascript.   I haven't quite figured out how to set that yet. >>

>I really wouldn't recommend doing what you're trying to do.  Using transformation/scaling will not work very cleanly >relative to other elements in the application, and anything else is non-standard.

The following code seems to work on all Desktop browsers:

procedure TFormOverview.Button10Click(Sender: TObject);
var
 box : variant;
begin              
 box := window.document.getElementsByTagName('body')[0];
 if isie then
   eval('box.style.zoom = "0.8"')
 else begin
   eval('box.style.webkitTransform = "scale( 0.8)"');
   eval('box.style.webkitTransformOrigin = "0 0"');
 end;
end;

where eval is defined as
extern function eval( s: string):variant;
;
http://www.erickengelke.com
Thu, Nov 9 2017 5:54 AMPermanent Link

Matthew Jones

erickengelke wrote:

> However it would be complicated because the project had a lot of complicated forms, redoing all the controls, fonts, etc. would have been a fair bit of work to resize everything, even if I automated it in a loop.

FWIW, I used exactly that in one project I did to allow a large/small option. It was pretty instant as far as the user was concerned, and the only complication was ensuring that it only changed the standard font sized items to not change headings etc.

--

Matthew Jones
Fri, Nov 10 2017 11:12 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Erick,

<< I agree, that's the best way to do it. >>

It's not just the "best" way to do it: if you use transform and scaling, then EWB will have *no* idea of what the actual real size (in logical browser pixels) of the scale UI elements are anymore.  EWB has no knowledge that you scaled the control and changed it's visual size in the browser, and will continue to layout everything without that knowledge.

In other words, there is a very real possibility that there are some edge cases here that may end up biting you later.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Nov 14 2017 12:01 PMPermanent Link

erickengelke

Avatar

Tim Young [Elevate Software] wrote:

Erick,

<< I agree, that's the best way to do it. >>

>It's not just the "best" way to do it: if you use transform and scaling, then EWB will have *no* idea of what the actual real size (in logical browser pixels) of the scale UI elements are anymore.  EWB has no knowledge that you scaled the control and changed it's visual size in the browser, and will continue to layout everything without that knowledge.

> In other words, there is a very real possibility that there are some edge cases here that may end up biting you later.

Thanks for saying that.  I realize this is a poor man's solution and there are risks involved.

Thanks as always
Erick
http://www.erickengelke.com
Image