Creating folder form source and pages from resources

Creating folder form source and pages from resources

Postby Marco Turco » Sat Apr 28, 2007 5:09 pm

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
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Sat Apr 28, 2007 5:36 pm

Marco,

Please change samples/TestFld5.prg this way:

Code: Select all  Expand view
   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
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marco Turco » Sun Apr 29, 2007 6:54 am

Yes, it runs.
Thanks Antonio.

Best Regards,

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

Postby Marco Turco » Mon Apr 30, 2007 9:38 am

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
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Mon Apr 30, 2007 12:02 pm

Marco,

Please use this workaround:
Code: Select all  Expand view
   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
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marco Turco » Mon Apr 30, 2007 3:12 pm

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
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Mon Apr 30, 2007 7:09 pm

Marco,

You may need to resize the folder dialogs everytime the folder is resized:
Code: Select all  Expand view
    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
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marco Turco » Tue May 01, 2007 7:29 am

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[i]:nWidth:=oFld:nWidth-7
oFld:aDialogs[i]:nHeight:=oFld:nHeight-28
next

return nil

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

Any ideas ?

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

Postby Antonio Linares » Tue May 01, 2007 12:27 pm

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
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marco Turco » Tue May 01, 2007 4:17 pm

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
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Wed May 02, 2007 7:43 am

Marco,

Fixed :-)
Code: Select all  Expand view
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
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marco Turco » Wed May 02, 2007 8:41 am

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

Postby Antonio Linares » Wed May 02, 2007 8:45 am

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
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 33 guests