Page 1 of 1

Tabs not resizing properly

Posted: Tue Sep 09, 2014 7:31 am
by TWolfe
Just added the 'ANGLE' parameter to some tab pages and noticed that resizing does not work properly with the angle set. You can shrink a page properly, but expanding horizontally does not increase the tab size.

See sample program below. If you comment out the angle argument on tab #1, resizing works properly.

Also tab height never increases even when the font is too tall to fit.

Any Ideas?

Terry

Code: Select all

#include "dcdialog.ch"

PROCEDURE MAIN()
LOCAL oDlg, oDraw:={}, GetOptions, GetList:={}, ;
      oTabPage1, oTabPage2

@ 6,1 DCTABPAGE oTabPage1 CAPTION 'Tab Page #1'   ;
          PREOFFSET 0 POSTOFFSET 60  ;
          ANGLE 30  ;     // Comment this line out and resize works properly
          SIZE 40,8

@ 0,0 DCTABPAGE oTabPage2 CAPTION 'Tab Page #2' ;
        RELATIVE oTabPage1
DCGETOPTIONS EXITVALIDATE RESIZE RESIZEDEFAULT DCGUI_RESIZE_AUTORESIZE_SCALEFONT

DCREAD GUI FIT ;
   OPTIONS GetOptions

RETURN

PROCEDURE AppSys()
RETURN

Re: Tabs not resizing properly

Posted: Wed Sep 10, 2014 5:28 pm
by rdonnay
I am looking at this now.
I'll get back to you soon with an answer.

Re: Tabs not resizing properly

Posted: Wed Sep 10, 2014 7:28 pm
by rdonnay
Terry -

This is a bit of a kludgy workaround, but it seems to work.

Code: Select all

#include "dcdialog.ch"

PROCEDURE MAIN()
LOCAL oDlg, oDraw:={}, GetOptions, GetList:={}, oTabPage1, oTabPage2, bAction, bResize

bAction := {||oTabPage1:configure(), oTabPage2:configure()}

@ 6,1 DCTABPAGE oTabPage1 CAPTION 'Tab Page #1'   ;
          PREOFFSET 0 POSTOFFSET 60  ;
          ANGLE 30  ;     // Comment this line out and resize works properly
          SIZE 40,8 ;

@ 0,0 DCTABPAGE oTabPage2 CAPTION 'Tab Page #2' ;
        RELATIVE oTabPage1 ;

DCGETOPTIONS EXITVALIDATE RESIZE RESIZEDEFAULT DCGUI_RESIZE_AUTORESIZE_SCALEFONT

DCREAD GUI FIT ;
   OPTIONS GetOptions ;
   EVAL {|o|bResize := o:resize, o:resize := {|a,b,o|Eval(bResize,a,b,o),Eval(bAction)}}

RETURN

PROCEDURE AppSys()
RETURN

Re: Tabs not resizing properly

Posted: Fri Sep 12, 2014 10:40 am
by rdonnay
Here is a better solution, which I have added to eXpress++ build 260.

Make the following change to the DC_Resize() function in _DCFUNCT.PRG:

WAS:

Code: Select all

  IF oXbp:isDerivedFrom('DC_XbpTabPage') .AND. Valtype(oXbp:staticArea) == 'O'
    Eval(oXbp:resize,aOldSize,aNewSize,oXbp)
    oXbp := oXbp:staticArea
  ENDIF
IS:

Code: Select all

  IF oXbp:isDerivedFrom('DC_XbpTabPage')
    IF Valtype(oXbp:staticArea) == 'O'
      Eval(oXbp:resize,aOldSize,aNewSize,oXbp)
      oXbp := oXbp:staticArea
    ENDIF
    IF oXbp:angle > 0
      oXbp:configure()
    ENDIF
  ENDIF
Rebuild DCLIPX.DLL by running BUILD19_SL1.BAT

Re: Tabs not resizing properly

Posted: Fri Sep 12, 2014 11:02 am
by TWolfe
Roger, there appears to be a problem with this fix.
I will do more testing and let you know what I find.

Error is object has no method 'ANGLE'.

Funny, it works perfectly on the sample program I sent you, but does not work in my application???

Terry

Re: Tabs not resizing properly

Posted: Fri Sep 12, 2014 1:26 pm
by TWolfe
The sample program did not use 'STATICAREA'

As soon as you add 'STATICAREA' the system fails.

Code: Select all

#include "dcdialog.ch"

PROCEDURE MAIN()
LOCAL oDlg, oDraw:={}, GetOptions, GetList:={}, oTabPage1, oTabPage2, bAction, ;
      bResize, oT1, oT2, cc1, cc2, cc3

cc1:=cc2:=cc3 := "Just some Text                         "

@ 6,1 DCTABPAGE oTabPage1 CAPTION 'Tab Page #1'   ;
          PREOFFSET 0 POSTOFFSET 60  ;
          STATICAREA oT1 ;
          ANGLE 30  ;     // Comment this line out and resize works properly
          SIZE 40,8 ;

DCSETPARENT TO oT1

@ 1,3  DCSAY "Tab 1 Line 1" GET cc1 SAYRIGHT SAYSIZE 15
@ 2,3  DCSAY "Tab 1 Line 2" GET cc2 SAYRIGHT SAYSIZE 15
@ 3,3  DCSAY "Tab 1 Line 3" GET cc3 SAYRIGHT SAYSIZE 15

DCSETPARENT TO

@ 0,0 DCTABPAGE oTabPage2 CAPTION 'Tab Page #2' ;
        STATICAREA oT2 ;
        RELATIVE oTabPage1

DCGETOPTIONS EXITVALIDATE RESIZE RESIZEDEFAULT DCGUI_RESIZE_AUTORESIZE_SCALEFONT

DCREAD GUI FIT ;
   OPTIONS GetOptions //;
  // EVAL {|o|bResize := o:resize, o:resize := {|a,b,o|Eval(bResize,a,b,o),Eval(bAction)}}

RETURN

PROCEDURE AppSys()
RETURN

I changed the fix to the _DCFUNCT.PRG as follows:

Code: Select all

IF oXbp:isDerivedFrom('DC_XbpTabPage')
  IF Valtype(oXbp:staticArea) == 'O'
    Eval(oXbp:resize,aOldSize,aNewSize,oXbp)
    IF oXbp:angle > 0
      oXbp:configure()
    ENDIF
    oXbp := oXbp:staticArea
  ENDIF
ENDIF
This does not throw an error, but the redraw events are so frequent that the dialog locks-up after a few resizes.

This is not a big deal, I will just not use the 'ANGLE' clause on tabs until I find a better solution.

Bottom line: back out the changes from _DCFUNCT.PRG untill this is worked out.

Terry

Re: Tabs not resizing properly

Posted: Fri Sep 12, 2014 1:54 pm
by rdonnay
Oops, I didn't look at my code very closely.

This should fix it:

Change this:

Code: Select all

  IF oXbp:isDerivedFrom('DC_XbpTabPage')
    IF Valtype(oXbp:staticArea) == 'O'
      Eval(oXbp:resize,aOldSize,aNewSize,oXbp)
      oXbp := oXbp:staticArea
    ENDIF
    IF oXbp:angle > 0
      oXbp:configure()
    ENDIF
  ENDIF
To this:

Code: Select all

  IF oXbp:isDerivedFrom('DC_XbpTabPage')
    IF oXbp:angle > 0
      oXbp:configure()
    ENDIF
    IF Valtype(oXbp:staticArea) == 'O'
      Eval(oXbp:resize,aOldSize,aNewSize,oXbp)
      oXbp := oXbp:staticArea
    ENDIF
  ENDIF