Dynamic FOLDER problem with GET on XP

Postby alexstrickland » Sat Sep 15, 2007 3:40 pm

Hi Antonio

The groups actually aren't too important, and the hanging doesn't matter either as I have a work around.

But it doesn't look too good, and even if I take the XP themes off, it's still not so good.

You suggested that I try and use the resource editor, as you can see, I have little chance there, but what is the difference ultimately between dynamically defining the dialog, and creating it via the resource editor?

Regards
Alex
alexstrickland
 
Posts: 23
Joined: Thu Aug 30, 2007 8:52 am

Postby Antonio Linares » Sat Sep 15, 2007 5:55 pm

Alex,

> but what is the difference ultimately between dynamically defining the dialog, and creating it via the resource editor?

Its easier for you :-)

Lets see if we can help you, the problem is that your sample is not an easy one.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby alexstrickland » Tue Sep 18, 2007 7:39 am

Hi Antonio

Thanks for your help. I am under some pressure to get some code out, if you think that a fix may take a while, please let me know and I will code an alternate solution without tabs temporarily.

Thank you
Alex
alexstrickland
 
Posts: 23
Joined: Thu Aug 30, 2007 8:52 am

Postby Antonio Linares » Tue Sep 18, 2007 7:48 am

Alex,

Could you provide us a simpler and smaller sample ? thanks

Your current example has 1301 lines source code and 45003 bytes
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby alexstrickland » Tue Sep 18, 2007 11:44 am

Hi Antonio

I have reviewed everything you have said again, and it now does not hang and the groups do not obscure the other data. The code below demonstrates the remaining problems.

This is folder.prg with your fix applied (correctly I hope - see TFixFolder), and some extra controls.

It demonstrates the same problem originally reported with the folder, group boxes do not look good, radio buttons look terrible, and the normal button had a strange frame.

The original fix as shown here does not actually do anything, I had to comment out the two lines:
if IsAppThemed()
endif

and then it did something, but it was worse.

Regards
Alex

Code: Select all  Expand view  RUN

#include "fivewin.ch"

function Main()

   local oDlg, oFld
   local oGet, cGet := "     "
   local oGroup
   local oSay, cSay := "Say buddy"
    local oRadio, nRadio := 1

   DEFINE DIALOG oDlg TITLE "FiveWin Dynamic folders" ;
      FROM 5, 5 TO 30, 49

   /*@ 0.5, 1 FOLDER oFld PROMPT "&xBase", "&And OOP", "&Power" ;
      OF oDlg SIZE 160, 90*/
            // This fix does not seem to help
   oFld := TFixFolder():New( 0.5, 1, {"&xBase", "&And OOP", "&Power"}, {}, oDlg,,,, .F., .F., 160, 160,, .F., )

    // Comment this line to get proper Folder colour
   @ 0, 1 GROUP oGroup TO 9, 15 OF oFld:aDialogs[ 1 ]

   @ 1, 2 BUTTON "&Hello" OF oFld:aDialogs[ 1 ] ;
     ACTION MsgInfo( "Hello world!" )

    // Comment this line to get proper Folder colour
   @ 3, 2 GET oGet VAR cGet OF oFld:aDialogs[ 1 ]

   @ 4, 2 SAY oSAY VAR cSAY OF oFld:aDialogs[ 1 ]

    // If get commented this looks sort of ok, otherwise really bad
    @ 6, 2 RADIO oRadio VAR nRadio ITEMS "radio 5" OF oFld:aDialogs[ 1 ]

   @ 9.5, 11 BUTTON "Ok" OF oDlg ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED

return nil

procedure AppSys // Xbase++ requirement

return

#define FD_TABMARGIN        40

CLASS TFixFolder INHERIT TFolder

    METHOD Default()

    METHOD LoadPages( aResNames, bRedefineControls )

ENDCLASS


METHOD Default() CLASS TFixFolder

   local nLen := Len( ::aPrompts ), n
   local oDlg
   local nHeight := ::nFdHeight

   #ifndef __CLIPPER__
      nHeight *= TabGetRowCount( ::hWnd )
   #endif

   if nLen > 0
      if ::lAllWidth
         ::nTabSize = int( ::nWidth() / nLen )
      else
         ::nTabSize := 0
         for n = 1 to nLen
            ::nTabSize = Max( ::nTabSize, ;
                              int( GetTextWidth( 0, ::aPrompts[n], ;
                              ::oFont:hFont ) + FD_TABMARGIN ) )
         next n
         ::nTabSize = Min( ::nTabSize, int( ::nWidth() / nLen ) )
      endif
   else
      ::nTabSize = ::nWidth()
   endif

   for nLen = 1 to Len( ::aDialogs )
      oDlg = ::aDialogs[ nLen ]

     #ifdef __CLIPPER__
         ACTIVATE DIALOG oDlg NOWAIT ;
            ON INIT ( oDlg:Move( nHeight + 2, 3 ) ) ;
            VALID .f.                // to avoid exiting pressing Esc !!!
      #else
         if ChildLevel( ::oWnd, TDialog() ) == 1
            if ! ::oWnd:lResize16
               ACTIVATE DIALOG oDlg NOWAIT ;
                  ON INIT oDlg:Move( nHeight - 1, 1 ) ;
                  VALID .f.                // to avoid exiting pressing Esc !!!
            else
               ACTIVATE DIALOG oDlg NOWAIT ;
                  ON INIT oDlg:Move( nHeight - 1, 1 ) ;
                  VALID .f. RESIZE16       // to avoid exiting pressing Esc !!!
            endif
         else
            ACTIVATE DIALOG oDlg NOWAIT ;
               ON INIT oDlg:Move( nHeight - 1, 1 ) ;
               VALID .f.                   // to avoid exiting pressing Esc !!!
         endif
      #endif

      #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

   if Len( ::aDialogs ) > 0
      if ::nOption <= Len( ::aDialogs )
         ::aDialogs[ ::nOption ]:Show()
      endif
   endif

return nil


METHOD LoadPages( aResNames, bRedefineControls ) CLASS TFixFolder

   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


alexstrickland
 
Posts: 23
Joined: Thu Aug 30, 2007 8:52 am

Postby Antonio Linares » Tue Oct 02, 2007 4:02 am

Alex,

Your code looks fine here on first try:

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby alexstrickland » Tue Oct 02, 2007 7:57 am

On XP I get:

Image

I hope you do :)

Regards
Alex
alexstrickland
 
Posts: 23
Joined: Thu Aug 30, 2007 8:52 am

Postby Antonio Linares » Tue Oct 02, 2007 8:48 am

Alex,

You are using themes, thats the difference :-)

We are going to review it, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Tue Oct 02, 2007 1:52 pm

Alex,

Have you tried the TRANSPARENT clause in the GROUP definition?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Wed Oct 03, 2007 3:51 am

Dear James,

I have sent you several emails and got no answer from you yet. Please check my emails, thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Wed Oct 03, 2007 5:03 am

Alex,

Please do it this way (see below the results):
Code: Select all  Expand view  RUN
#include "fivewin.ch"

function Main()

   local oDlg, oFld
   local oGroup
   local oSay, cSay := "Say buddy"
   local oRadio, nRadio := 1

   DEFINE DIALOG oDlg TITLE "FiveWin Dynamic folders" ;
      FROM 5, 5 TO 30, 49

   @ 0.5, 1 FOLDER oFld PROMPT "&xBase", "&And OOP", "&Power" ;
      OF oDlg SIZE 160, 160

   @ 0, 1 GROUP oGroup TO 9, 15 OF oFld:aDialogs[ 1 ]
   oGroup:lTransparent = .T.

   @ 1, 2 BUTTON "&Hello" OF oFld:aDialogs[ 1 ] ;
     ACTION MsgInfo( "Hello world!" )

   @ 4, 2 SAY oSAY VAR cSAY OF oFld:aDialogs[ 1 ]

   @ 6, 2 RADIO oRadio VAR nRadio ITEMS "radio 1", "radio 2" OF oFld:aDialogs[ 1 ]

   @ 9.5, 11 BUTTON "Ok" OF oDlg ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT PlaceGet( oFld )

return nil

function PlaceGet( oFld )

   local oGet, cGet := "     "

   @ 7, 4 GET oGet VAR cGet OF oFld:aDialogs[ 1 ] SIZE 80, 20

return nil

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 36 guests