GETOPTIONS AUTOZOOM

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

GETOPTIONS AUTOZOOM

#1 Post by Tom »

Hi, Roger.

I love the SCALEFACTOR option. Since my app is layouted initially for XGA (1024 x 768), I provide an option to automatically scale the app if the resolution is higher. An app-wide scalefactor is calculated, using the lower value of width and height, so even monitors with strange resolutions give a proper result. A dialog "zoomed" with the scalefactor option looks excellent - all fonts are resized, even those inside browses, if everything is set properly. This is a really, really valuable option! Thanks for it!

But if this option is not set and a dialog is resized with DC_AutoResize() or the resize option of DCGET OPTIONS, only the controls itself get resized (depending on the settings), but not their fonts. May it be possible to have an autoresize acting like the scalefactor option? Something like "AUTOZOOM"? Or is it already in there - and I didn't find it yet?

Tom
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: GETOPTIONS AUTOZOOM

#2 Post by rdonnay »

Tom -

The eXpress++ resizing system was designed to automatically resize the font, but currently there is only one manifest constant that does this:

From DCDIALOG.CH:

#define DCGUI_RESIZE_AUTORESIZE { DCGUI_REPOS_AUTO_BLOCK, DCGUI_RESIZE_AUTO_BLOCK, .f. }
#define DCGUI_RESIZE_AUTORESIZE_SCALEFONT { DCGUI_REPOS_AUTO_BLOCK, DCGUI_RESIZE_AUTO_BLOCK, .t. }

Resizing uses an array of 3 elements:

1. The repositioning code block
2. The resizing code block
3. A logical value specifying if font should also be resized.

If you are using DCGUI_RESIZE_AUTORESIZE now, then you can change it to DCGUI_RESIZE_AUTORESIZE_SCALEFONT.

This only works the the DCGETOPTIONS RESIZE clause, not DCGETOTPIONS AUTORESIZE.

AUTORESIZE was my first attempt (many years ago). RESIZE came later when I knew much more and had a better idea.

You can create your own manifest constants.

Example:

This is already in DCDIALOG.CH

#define DCGUI_RESIZE_REPOSX_RESIZEY { DCGUI_REPOSX_BLOCK, DCGUI_RESIZEY_BLOCK, .f. }

This is what you would do to add automatic font scaling:

#define DCGUI_RESIZE_REPOSX_RESIZEY_SCALEFONT { DCGUI_REPOSX_BLOCK, DCGUI_RESIZEY_BLOCK, .t. }
The eXpress train is coming - and it has more cars.

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: GETOPTIONS AUTOZOOM

#3 Post by Tom »

Hi, Roger.

This seems to work well, but:

1. The "HILITEGETS"-rectangles leave fractions on the screen, if a dialog is resized while a control has focus and shows the "highlightning".

2. It seems that hidden objects (HIDE-clause replies .T.) are not moved and/or resized. This leaves fractions of them somewhere they were before the dialog was resized if they show up again. I can create a sample for this if you need one.

3. Dialog buttons added with the ADDBUTTONS get never resized and/or moved. This is also true for DCSTATUS- and -TOOLBARS.

Nothing urgent. Just cosmetics. ;)

Tom
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: GETOPTIONS AUTOZOOM

#4 Post by Cliff Wiernik »

Tom, are you using Xbase with themes turned on. The default Hilitegets, does not full clear out the hilite when the default luna them and XBPSYSCLR_TRANSPARENT was used. This is likely what you are seeing. I had Roger put in a get/set function to use a different hilite clearing options.

This is my code:

Code: Select all

*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
*+    Function LB_HiliteGets( o, nMode, nbColor )
*+
*+      // Modification of DC_HiliteGets to remove the hilite when used with themes
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+ 
FUNCTION LB_HiliteGets( o, nMode, nbColor )

LOCAL oPS, nCol, nRow, nWidth, nHeight, aAttr[ GRA_AL_COUNT]

//IF Empty(nbColor) .OR. Valtype(o) # 'O' .OR. o:status() <= 0  ;
//      .OR. o:isDerivedFrom('XbpCrt') .OR. !o:isVisible() .OR. !o:isEnabled()
//  RETURN nil
//ENDIF

  IF o:isderivedfrom('XBPCOMBOBOX')
    nWidth := o:XbpSle:currentsize()[1]
    IF o:type # XBPCOMBO_SIMPLE
      nHeight := o:sleSize()[2]
      nCol := o:currentpos()[1]
      nRow := o:currentpos()[2] + o:currentsize()[2] - nHeight
    ELSE
      nHeight := o:currentsize()[2]
      nCol := o:currentpos()[1]
      nRow := o:currentpos()[2]
    ENDIF
  ELSE

    nCol := o:currentpos()[1]
    nRow := o:currentpos()[2]
    nWidth := o:currentsize()[1]
    nHeight := o:currentsize()[2]

  ENDIF

  IF IsMethod(o:SetParent(),'LOCKPS')
    oPS := o:setParent():lockPS()
  ENDIF

/*
  IF nMode = 1
    IF Valtype(nbColor) == 'B'
      nbColor := Eval(nbColor)
      IF nbColor == NIL
        nbColor := o:setParent():setColorBG()
      ENDIF
    ENDIF
    aAttr[ GRA_AL_COLOR ] := nbColor
  ELSE
    aAttr[ GRA_AL_COLOR ] := GRA_CLR_BACKGROUND
  ENDIF
  GraSetAttrLine( oPS, aAttr )
  GraBox( oPS, {nCol-1,nRow-1}, {nCol+nWidth,nRow+nHeight}, GRA_OUTLINE )
*/

  IF nMode = 1
    IF Valtype(nbColor) == 'B'
      nbColor := Eval(nbColor)
      IF nbColor == NIL
        nbColor := o:setParent():setColorBG()
      ENDIF
    ENDIF
    aAttr[ GRA_AL_COLOR ] := nbColor
    GraSetAttrLine( oPS, aAttr )
    GraBox( oPS, {nCol-1,nRow-1}, {nCol+nWidth,nRow+nHeight}, GRA_OUTLINE )
  ELSE
    IF version(3) > '345' .AND. IsThemeActive(.T.)
      o:setParent():invalidateRect({nCol-1,nRow-1,nCol+nWidth+1,nRow+nHeight+1},,XBP_INVREGION_LOCK)
      o:setParent():invalidateRect({nCol,nRow,nCol+nWidth,nRow+nHeight},,XBP_INVREGION_XOR+XBP_INVREGION_RELEASE)
    ELSE
      aAttr[ GRA_AL_COLOR ] := GRA_CLR_BACKGROUND
      GraSetAttrLine( oPS, aAttr )
      GraBox( oPS, {nCol-1,nRow-1}, {nCol+nWidth,nRow+nHeight}, GRA_OUTLINE )
    ENDIF
  ENDIF

  IF Valtype(oPS) = 'O'
    o:setParent():unlockPS(oPS)
  ENDIF

  RETURN nil
It replaces the default Express++ code.

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: GETOPTIONS AUTOZOOM

#5 Post by Tom »

Hi, Cliff.

Thanks for that - but this is a different problem.

The issue with resizing occurs if the highlighting is stil on (highlighted object has focus while the dialog is resized). This misbehaves with every OS. The highlighting shows, the dialog is resized, but the hl-rectangle stays there with it's old size.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: GETOPTIONS AUTOZOOM

#6 Post by Tom »

There is another side effect: If DC_AutoRestoreBrowse is in use and a dialog containing a browse is resized this way, DC_AutoRestoreBrowse stores the font changes.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: GETOPTIONS AUTOZOOM

#7 Post by rdonnay »

It looks like DC_AutoRestoreBrowse() needs to store the original fonts.

I thought I may be able to give you a quick fix but after looking at the code, it looks like this could take a bit of work.

On second thought, maybe it's not so much work after all.

Attached is an updated _DCXBROW.PRG
Attachments
_dcxbrow.zip
Fix for DC_AutorestoreBrowse() and font scaling.
(21.64 KiB) Downloaded 705 times
The eXpress train is coming - and it has more cars.

Post Reply