Creating folder form source and pages from resources

Post Reply
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Creating folder form source and pages from resources

Post by Marco Turco »

Hi,
I would like to make a folder via source code and then load the pages from an rc file.

I take a look to the Fivewin sample testfld5.prg (provided in the sample FWH directory) that make this with the method LoadPages but only the first page is displayed.

Any ideas ?
Is there any problem using the method LoadPages as you know ?

I'm working with the latest FWH&XHB versions.

Thanks in advance.

Best Regards,

Marco Turco
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marco,

Please change samples/TestFld5.prg this way:

Code: Select all

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oFld:LoadPages( { "one", "two" },;
                                { | oFld, nPage | SetCtrls( oFld, nPage ) } ),;
                oFld:SetPrompts( { "one", "two" } ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Post by Marco Turco »

Yes, it runs.
Thanks Antonio.

Best Regards,

Marco
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Post by Marco Turco »

Oops. There is still a little problem.
The XP style doesn't work loading the folder pages from resources.

See image at www.softwarexp.co.uk/beta/folder.png
and the self contained sample at www.softwarexp.co.uk/beta/folder.zip

Is there any solution available ?

Thanks in advance

Best Regards,

Marco Turco
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marco,

Please use this workaround:

Code: Select all

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oFld:LoadPages( { "one", "two" },;
                              { | oFld, nPage | SetCtrls( oFld, nPage ) } ),;
                oFld:SetPrompts( { "one", "two" } ),;
                oFld:aDialogs[ 1 ]:nWidth := oFld:nWidth - 7,;
                oFld:aDialogs[ 1 ]:nHeight := oFld:nHeight - 28,;         
                oFld:aDialogs[ 2 ]:nWidth := oFld:nWidth - 7,;
                oFld:aDialogs[ 2 ]:nHeight := oFld:nHeight - 28 )         
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Post by Marco Turco »

It run with a "static" dialog
but this problem still appairs on a splitter environment when the folder is created on the window.

See this sample image at www.softwarexp.co.uk/beta/splitter.png
and my self-contained sample at www.softwarexp.co.uk/beta/splitter.zip.

Did I forget something ? I'm working a lot this time.

Marco
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marco,

You may need to resize the folder dialogs everytime the folder is resized:

Code: Select all

    for i:=1 to 2
        oFld:aDialogs[i]:nWidth:=oFld:nWidth-7
        oFld:aDialogs[i]:nHeight:=oFld:nHeight-28
    next
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Post by Marco Turco »

Hi,
I tried adding that code in the resize routine (see below)
but it doesn't runs.

****

function ridimensiona(oWnd,oSplit,oBrw,oFld,oBtn,oCbx)

local i

oSplit:nFirst=oWnd:nWidth()-oSplit:nWidth-300
oFld:Move(90,oSplit:nFirst+oSplit:nWidth,oWnd:nHeight-200-60,100,.t.)
oBrw:Move(85,05,oSplit:nFirst-10,oWnd:nHeight-200-60,.t.)
oBtn:Move(oWnd:nHeight()-120,05,90,25,.t.)
oCbx:Move(oWnd:nHeight()-160,05,oSplit:nFirst-60-20,100,.t.)

oSplit:ADjClient()

for i:=1 to 2
oFld:aDialogs:nWidth:=oFld:nWidth-7
oFld:aDialogs:nHeight:=oFld:nHeight-28
next

return nil

************

Any ideas ?

Marco
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marco,

Whats the problem in this sample ?
www.softwarexp.co.uk/beta/splitter.png

It looks fine :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Post by Marco Turco »

The problem is that the folder color has to be white and not gray.
When the folder's pages are loaded from resource the folder pages doesn't appairs with the XP theme manager color.

This is a correct folder image :
www.softwarexp.co.uk/beta/correct.png

Marco
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marco,

Fixed :-)

Code: Select all

METHOD LoadPages( aResNames, bRedefineControls ) CLASS TFolder

   local n, oDlg
   local oThis := Self

   ::DelPages()

   ::aPrompts = aResNames
   ::aDialogs = Array( Len( aResNames ) )

   for n = 1 to Len( ::aDialogs )
      DEFINE DIALOG oDlg OF Self RESOURCE aResNames[ n ] ;
         FONT Self:oFont

      ::aDialogs[ n ] = oDlg

      if bRedefineControls != nil
         Eval( bRedefineControls, Self, n )
      endif

      ACTIVATE DIALOG oDlg NOWAIT ;
         ON INIT ( oDlg:Move( oThis:nFdHeight + 2, 3, oThis:nWidth - 6, oThis:nHeight - oThis:nFdHeight - 5 ) ) ;
         VALID .f.                // to avoid exiting pressing Esc !!!

      #ifndef __CLIPPER__
         if IsAppThemed()
            // oDlg:SetBrush( TBrush():New( "NULL" ) )
            if Empty( oDlg:oBrush:hBitmap )
               oDlg:bEraseBkGnd = { | hDC | DrawPBack( oDlg:hWnd, hDC ), 1 }
            endif   
         endif
      #endif

      oDlg:Hide()
   next

   ::nOption = 1
   ::aDialogs[ 1 ]:Show()

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Post by Marco Turco »

Great !!
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marco,

The loaded pages size is automatically set now, so you don't need to set those values :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply