Page 1 of 2

Folder Itemsize

Posted: Sun Jan 31, 2010 3:24 pm
by Dietmar Jahnel
Antonio,

I want to increase the height of the tab control items using SetItemsize when themes are active.
It is working fine as long as the transparent clause is not used.
Please see the difference in the modified testfld4.prg below once compiled with TRANSPARENT once without (with themes in RC-file)
I'm using FWH 9.07.

How can this be fixed?
Thanks for help,
Dietmar


Code: Select all

#include "fivewin.ch"

PROCEDURE main()
    LOCAL oDlg, oFolder
    LOCAL cContrato:=space(13)  ,;
          cNombre:=space(30)    ,;
          cDireccion:=space(60) ,;
          cTelefono:=space(10)  ,;
          cNotas:=""

    //Define dialogo
    DEFINE DIALOG oDlg NAME "DLGTEST";
        TITLE "Another folder test";
         TRANSPARENT

//    Redefine controles
    REDEFINE GET cContrato;
        ID 101 OF oDlg;
        PICTURE "@!" ;
        VALID !empty(cContrato)

    //Redefine controles del dialogo
   REDEFINE FOLDER oFolder             ;
        ID 102                           ;
        OF oDlg                          ;
        PROMPTS "Pagina &1","Pagina &2"  ;
        DIALOGS "DlgPage1", "DlgPage2"

    // oFolder:lWin95Look:=.f.

    //Redefine controles del 1er. page
    *=======================================================================
    REDEFINE GET cNombre;
        ID 101 OF oFolder:aDialogs[1];
        PICTURE "@!" ;
        VALID !empty(cNombre)

    REDEFINE GET cDireccion;
        ID 102 OF oFolder:aDialogs[1];
        PICTURE "@!";
        VALID !empty(cDireccion)

    REDEFINE GET cTelefono;
        ID 103 OF oFolder:aDialogs[1]

   REDEFINE BTNBMP ;
        ID 104 OF oFolder:aDialogs[1];
        NAME "CANCELAR";
        ACTION ( MsgDate() )

    //Redefine controles del 2do. page
    *=======================================================================
    REDEFINE GET cNotas;
        ID 101 OF oFolder:aDialogs[2];
        MEMO

    *=======================================================================
    REDEFINE BUTTON;
        ID 201 OF oDlg

    REDEFINE BUTTON;
        ID 202 OF oDlg;
        ACTION oDlg:end() CANCEL

    //Activar dialogo
    ACTIVATE DIALOG oDlg CENTER;
    On INIT IIF(IsThemeActive(), oFolder:SetItemsize( ,25 ), ) //---> changed
RETURN

procedure AppSys  // Xbase++ requirement

return
 

Re: Folder Itemsize

Posted: Tue Feb 02, 2010 1:05 pm
by Dietmar Jahnel
To make things clearer, this it the result:

Image

Without transparent clause, the folders are painted ok.

How can this be fixed?
Dietmar

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 9:55 am
by Antonio Linares
Dietmar,

We are reviewing Windows include\commctrl.h where all styles and messages for folders are defined.

Maybe this message could help: TCM_SETITEMSIZE
http://msdn.microsoft.com/en-us/library ... S.85).aspx

also, this one could help: TCM_ADJUSTRECT
http://msdn.microsoft.com/en-us/library ... S.85).aspx

Finally, this may be also an option: TCM_SETPADDING
http://msdn.microsoft.com/en-us/library ... S.85).aspx

To call those functions you can easily build a C wrapper in the same way as we do them in:
fwh\source\winapi\tabctrl.c

If you need some more help, please let me know it :-)

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 10:00 am
by Antonio Linares
Dietmar,

You could easily test it doing:

Code: Select all

SendMessage( oFolder:hWnd, TCM_SETPADDING, 0, nMakeLong( 20, 20 ) )
 

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 10:07 am
by Antonio Linares
Dietmar,

The method that you have to use is already implemented in FWH Class TFolder :-)

Code: Select all

    ACTIVATE DIALOG oDlg CENTER ;
       ON INIT oFolder:SetItemSize( 200, 30 )
 

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 10:23 am
by Dietmar Jahnel
Antonio Linares wrote:Dietmar,

The method that you have to use is already implemented in FWH Class TFolder :-)

Code: Select all

    ACTIVATE DIALOG oDlg CENTER ;
       ON INIT oFolder:SetItemSize( 200, 30 )
 

Antonio,
I know and use this method. (see last lines of the code above)
The problem is that the folders are only painted correctly, if the dialg is NOT transparent
Same dialog WITH transparent on (which we need in this case) ---> painting result as above
Hope I expressed my problem now clearly...
Dietmar

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 10:37 am
by Antonio Linares
Dietmar,

Ok, Now I see what you mean, thanks :-)

Using 20, instead of 25, seems to improve it

Code: Select all

    ACTIVATE DIALOG oDlg CENTER;
       On INIT IIF(IsThemeActive(), oFolder:SetItemsize( ,20 ), ) //---> changed
 
Image

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 10:46 am
by Dietmar Jahnel
with 19 the painting is ok, but this is standard size.
In our case 25 would look a lot better. We use this in another folder, where transparent is not needed.
The TRANSPARENT-clause seems to erase the line under the folders??
Can this be fixed?
Dietmar

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 11:51 am
by Antonio Linares
Dietmar,

When clause TRANSPARENT is used on the folder, it sets all the contained dialogs to call DrawPBack() to fill each dialog surface. This function may be erasing that line.

To check it, please add this dummy function to your main PRG:

Code: Select all

function DrawPBack()
return nil
 
This way no fill painting will be done and we can check if the line is visible. Thanks for your feedback :-)

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 12:21 pm
by Dietmar Jahnel

Code: Select all

function DrawPBack()
return nil
 
This way no fill painting will be done and we can check if the line is visible. Thanks for your feedback :-)
Sorry, same result, the line is not visible,
Dietmar

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 12:42 pm
by Antonio Linares
Dietmar,

Then it means that DrawPBack() is not erasing that line.

Lets modify oFolder:nFdHeight which holds the height of the tabs to position the contained dialogs:

Code: Select all

   REDEFINE FOLDER oFolder             ;
        ID 102                           ;
        OF oDlg                          ;
        PROMPTS "Pagina &1","Pagina &2"  ;
        DIALOGS "DlgPage1", "DlgPage2"

   oFolder:nFdHeight += 5

   ...
 

try with different values there, thanks :-)

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 1:51 pm
by Dietmar Jahnel
   oFolder:nFdHeight += 5

try with different values there, thanks :-)
This one does not change the itemsize but the last 5 pixel at the bottom of the folder are not painted..
D.

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 1:55 pm
by Antonio Linares
Dietmar,

oFolder:nFdHeight keeps the height value of the tabs but does not modify it. That value is used to place the top margin of the contained dialogs.

Is the line still erased ? Please post a screenshot, thanks

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 4:32 pm
by Dietmar Jahnel
Is the line still erased ? Please post a screenshot, thanks
here it is, at the buttom is is not grey but white

Image

Re: Folder Itemsize

Posted: Wed Feb 03, 2010 8:16 pm
by Antonio Linares
Dietmar,

Please try to increase oFolder:nFdHeight with larger values, i.e.:

oFolder:nFdHeight += 15

Do it after the REDEFINE FOLDER ... command. You should notice that the contained dialogs top margins change.