A "special" - question about folders. => solved

A "special" - question about folders. => solved

Postby ukoenig » Tue Sep 09, 2008 3:37 pm

Hello,

The new Browser-tool-version 2a includes many new functions
and is nearly finished.

It is possible now, to create Gradient and Non-gradient Header and Footer.
Different fonts for Header and Footer ( Gradient and NON-gradient ).
Different colors for NON-gradient Header and Footer.

Image

I have a question :

Is it possible, to disable the footer-color-browser on page 2, in relation
to the setting < Gradien ON > < Gradient OFF > in page 1 ?
It means : If i change to Gradient -display, the 1. color-browser
on page 2 has to be disabled.

I tested like :

Code: Select all  Expand view
REDEFINE FOLDER oFld ID 110 OF oDlg  FONT oProgFont ;
PROMPTS "  &Header  ", "  &Footer  ", "  &Styles / Cells  ", ;
"  &Data-Colors / Font  ", " &Background / Bitmaps  ", "Settings"  ;
DIALOGS "Browse1","Browse2","Browse3","Browse4","Browse5","Browse6" ;
ON CHANGE( IIF( nOption = 2, ( FOLDER_2(oDlg,oFld,oLbx0, oRESULT0, oLbx6 ), oLbx6:Disable()), NIL ) )

// I changed to < Gradient > in page 1. After that,
// I changed to folder-page 2 and wanted the 1. color-browser disabled.
// but it didn't work.



Is there maybe another solution ?

Regards
Uwe :lol:
Last edited by ukoenig on Wed Sep 10, 2008 12:41 am, edited 4 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby James Bott » Tue Sep 09, 2008 3:49 pm

Uwe,

You have defined an ON CHANGE for the folders and that is not what you need. You are going to have to disable the browse inside the routine you are using to change the gradient flag.

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

Changing browser

Postby ukoenig » Tue Sep 09, 2008 4:06 pm

Hello James,

I tested this solution as well and there was a < msgalert >
after the define of < browser 1 > in page 2.
With the flag from page 1 : Gradient ON / OFF i want to enable / disable
the 1. browser on page 2.
It seems, if the folder is defined, the contents of the pages are
in memory. When i change to page 2, nothing happens.
( the page 2 runs only once at start ).
If i use < ON CHANGE > there is a stop, to define anything.

The browser for NON-gradient-color
The msgAlert is shown only once at start !!!

Code: Select all  Expand view

oLbx6 := TXBrowse():New( oFld:aDialogs[2] )
oLbx6:nMarqueeStyle := MARQSTYLE_HIGHLROW
oLbx6:nColDividerStyle    := LINESTYLE_BLACK
oLbx6:nRowDividerStyle := LINESTYLE_BLACK
oLbx6:nRecSelColor = 15512898
oLbx6:bClrSelFocus = { || { 16777215, 15512898 } }
oLbx6:bClrSel = { || { 16777215, 15512898 } }

oLbx6:SetArray( aBRCOLOR )
oLbx6:aCols[ 1 ]:cHeader = Padr("No.", 3)
oLbx6:aCols[ 2 ]:cHeader = Padr("Start", 19)
oLbx6:lHScroll := .F.
oLbx6:lVScroll := .F.
oLbx6:lFooter := .T.

oLbx6:bLClicked := { | nRow, nCol | BR_START := oLbx6:nRowSel, ;
   BR_COLOR3 := NEW_COLOR2(), ;
   NEW_FPAINT(oLbx0), ;
   oBmp1:bPainted := { |hDC|OnPaint1( hDC,oBMP1,BR_COLOR3) }, ;
   oBmp1:Refresh(), oBR_COLOR3:Refresh() }

oLbx6:aCols[ 2 ]:AddResource("Black")
oLbx6:aCols[ 2 ]:AddResource("White")
oLbx6:aCols[ 2 ]:AddResource("Blue")
oLbx6:aCols[ 2 ]:AddResource("Green")
oLbx6:aCols[ 2 ]:AddResource("Red")
oLbx6:aCols[ 2 ]:AddResource("Yellow")
oLbx6:aCols[ 2 ]:AddResource("Magenta")
oLbx6:aCols[ 2 ]:bBmpData := {|| oLbx6:nArrayAt }
oLbx6:aCols[ 2 ]:bStrData := {|| oLbx6:aRow[2] }   

oLbx6:nArrayAt := 3
oLbx6:nRowSel := 3

oLbx6:nFooterHeight := 15

oLbx6:CreateFromResource( 110 )

// Nothing happens, if you choose page 2
// The MsgAlert is only shown once at start.

IF nHEADGRAD = 1          // Gradient ON
   Msgalert( "Disabled" )
   oLbx6:Disable()
ENDIF
...
...
...


Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby James Bott » Tue Sep 09, 2008 4:33 pm

Uwe,

I do not see the code where you are changing the gradient flag. You cannot disable the browse during the screen setup code, or using any ON CHANGE clause. You are changing the gradient flag when the brows is running so you have to disable the other browse inside whatever routine you have that you are using to change the gradient flag.

I hope that is more clear.

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

Gradient Switch

Postby ukoenig » Tue Sep 09, 2008 4:51 pm

Hello James,

That is the SWITCH-browser on Page 1
The position defines the Var < nHEADGRAD > = 1 or 2
Inside Page 1, i can enable / disable Browser 2 and 4
and it works fine.
But i cannot reach the color-browser 1 on page 2
The easy way would be, to move this browser to page 1,
there it would be no problem, but there is no space anymore.
All Header-settings are on Page 1 and the Footer-settings are on page 2 now.

Code: Select all  Expand view

// --------------------- GRADIENT ON / OFF on Folder-page 1 ---------------

REDEFINE BUTTONBMP oTITLE10  ID 670 OF oFld:aDialogs[1] ;
ACTION MsgAlert("With this Browser, you set" + CRLF + ;
                                "the Gradient-Color to Single  Color","Gradient" ) ;
BITMAP "Info1" PROMPT "  Gradient" TEXTRIGHT
oTITLE10:cToolTip =  { "Click the Button" + CRLF + ;
                "for information","Click-color", 1, CLR_BLACK, 14089979 }

oLbx50 := TXBrowse():New( oFld:aDialogs[1] )
oLbx50:nMarqueeStyle := MARQSTYLE_HIGHLROW
oLbx50:nColDividerStyle    := LINESTYLE_BLACK
oLbx50:nRowDividerStyle := LINESTYLE_BLACK
oLbx50:SetArray( aHEADGRAD )
oLbx50:aCols[ 1 ]:cHeader = Padr("No.", 3)
oLbx50:aCols[ 2 ]:cHeader = Padr("Style", 20)
oLbx50:nRecSelColor = 15512898
oLbx50:bClrSelFocus = { || { 16777215, 15512898 } }
oLbx50:bClrSel = { || { 16777215, 15512898 } }
oLbx50:lHScroll := .F.
oLbx50:lVScroll := .F.
oLbx50:lFooter := .T.
oLbx50:nFooterHeight := 15

// On cursor-position 2, Browser oLbx3 and olbx5 are Disabled
// BRW_DISABL(oLbx3) and BRW_DISABL(oLbx5)
// do the Grey-painting

oLbx50:bLClicked := { | nRow, nCol | ( nHEADGRAD := oLbx50:nRowSel, ;
   IIF( nHEADGRAD = 2, ( oLbx3:Disable(), oLbx5:Disable(), ;
        BRW_DISABL(oLbx3), BRW_DISABL(oLbx5), ;
        NEW_HPAINT(oLbx0), NEW_FPAINT(oLbx0) ), ;
       ( oLbx3:Enable(), oLbx5:Enable(), ;
        BRW_ENABL(oLbx3), BRW_ENABL(oLbx5), ;
        NEW_HPAINT(oLbx0), NEW_FPAINT(oLbx0) ) ) ) }

oLbx50:aCols[ 2 ]:AddResource("Green")
oLbx50:aCols[ 2 ]:AddResource("Red")
oLbx50:aCols[ 2 ]:bBmpData := {|| oLbx50:nArrayAt }
oLbx50:aCols[ 2 ]:bStrData := {|| oLbx50:aRow[2] }   

oLbx50:nArrayAt := 1
oLbx50:nRowSel := 1

oLbx50:CreateFromResource( 150 )

....
....

// -----------------------------------------

FUNCTION BRW_DISABL(oLbx)

*oLbx:bClrGrad := NIL
*oLbx:l2007 := .F.
i := 1
FOR i := 1 TO LEN(oLbx:aCols)
   WITH OBJECT oLbx:aCols[i]
      :bClrHeader := { || { 0, 13750737 } }
      :bClrFooter := { || { 0, 13750737 } }
      :bClrStd = { || { 0, 13750737 } }
   END
NEXT

oLbx:Refresh()

RETURN( NIL )


Last edited by ukoenig on Tue Sep 09, 2008 5:02 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby James Bott » Tue Sep 09, 2008 4:56 pm

Uwe,

>But i cannot reach the color-browser 1 on page 2

I assume you mean the variable is not available. You can either make it a public (not recommended), a file-wide static, a static in a set/get function, or make your app into a class and make it DATA.

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

Switch xbrowse

Postby ukoenig » Tue Sep 09, 2008 5:16 pm

Hello James,

The var < nHEADGRAD > is public.

If i click on folder-tab 2, the screen is allways the same
like shown at the 1. folder-opening.
The function doesn't test the value of < nHEADGRAD >
and modifys the browser.
There have been some more alerts in the function.
The alerts don't display again, only once at the 1. folder-start.
The problem is : inside a page you can modify the values,
but from another page ?

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby James Bott » Tue Sep 09, 2008 5:25 pm

Uwe,

I guess I have still not been clear. The variable for the browse on folder 2 has to be visible--as a public or whatever.

>The problem is : inside a page you can modify the values,
but from another page ?

As long as the variables are accessible, you can change them from anywhere. This is why they have to be publics, statics, or class data.

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

Folder Structure

Postby ukoenig » Tue Sep 09, 2008 7:36 pm

Hello James,

I found out, what is wrong.
I had to do my own folder-structure, because the size of the application is very big.
I tested my structure with a small sample.
Result : the same problem.
Page 1 is a button with a counter
The alerts of page 2 and 3 are only shown at prog-start.
with a click on tab 2 or 3, no alert displays.
But actions inside the pages ( buttons ) are ok.
The counter-value display on button-click is ok, but the alerts are not
displayed. That is the reason, because i don't get the browser disabled.
I don't start a action inside of a folder-page to disable the browser.
On Button-click it works.
Only a folder-tab change, doesn't do this for me.

Code: Select all  Expand view

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

FUNCTION MAIN()

local oDlg, oFld

nCOUNTER := 1

DEFINE DIALOG oDlg TITLE "FiveWin Dynamic folders" ;
FROM 5, 5 TO 20, 50 COLOR "N/G"

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

PAGE_1( oFld )

PAGE_2( oFld )

PAGE_3( oFld )

ACTIVATE DIALOG oDlg CENTERED

RETURN NIL

// ---------------------------------------------------------------------------

FUNCTION PAGE_1( oFld )

@ 1, 1 BUTTON "&Counter" OF oFld:aDialogs[ 1 ] ;
     ACTION ( nCOUNTER++, MsgAlert( nCOUNTER ) )

RETURN NIL

// ---------------------------------------------------------------------------

FUNCTION PAGE_2( oFld )

@ 1, 1 BUTTON "&Counter" OF oFld:aDialogs[ 2 ] ;
     ACTION ( IIF( nCounter > 1, MsgAlert( nCounter ), NIL )

// That works only on Button-click
// but i don't want to press a button to disable the browser
// i need a automatic disable of the browser on page-changing
// ---------------------------------------------------------------------
If nCounter > 1
      MsgAlert( nCounter )
Endif

RETURN NIL

// ---------------------------------------------------------------------------

FUNCTION PAGE_3( oFld )

@ 1, 1 BUTTON "&Counter" OF oFld:aDialogs[ 3 ] ;
     ACTION ( MsgAlert( nCOUNTER ) )

MsgAlert( nCounter )

RETURN NIL



Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby James Bott » Tue Sep 09, 2008 8:08 pm

Uwe,

Code: Select all  Expand view
PAGE_1( oFld )

PAGE_2( oFld )

PAGE_3( oFld )

ACTIVATE DIALOG oDlg CENTERED


The three functions, page_1, page_2, and page_3 are going to get called once each just before the maine dialog is activated. This is not what you want.

You have to also define a dialog for each folder. The function to change the gradient has to be called from one of the controls on one of the folders. The browse you want to disable has to be a visible variable that can be accessed, then you can access it from the gradient change function.

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

Disable xBrowse in folderpage 2

Postby ukoenig » Wed Sep 10, 2008 12:59 am

Hello James,

I found a solution for my problem and it works perfect.

Image

Code: Select all  Expand view

At first, the browse-object on page 2 ( oLbx6 ) has to be static
The Switch-var < nHEADGRAD > is PRIVATE

static oWnd, oDlg, oFld, oLbx6

I used the old structure, but added ON CHANGE ( only needed for page 2 )

REDEFINE FOLDER oFld ID 110 OF oDlg  FONT oProgFont ;
PROMPTS "  &Header  ", "  &Footer  ", "  &Styles / Cells  ", "  &Data-Colors / Font  ", " &Background / Bitmaps  ", "Settings"  ;
DIALOGS "Browse1","Browse2","Browse3","Browse4","Browse5","Browse6" ;
ON CHANGE( TEST_FOLD( nOption, nOldOption, oLbx6 ) )

FOLDER_1(oDlg,oFld,oLbx0)

FOLDER_2(oDlg,oFld,oLbx0, oRESULT0)

FOLDER_3(oDlg,oFld,oLbx0)

FOLDER_4(oDlg,oFld,oLbx0)

FOLDER_5(oDlg,oFld,oLbx0)

FOLDER_6(oDlg,oFld,oLbx0)

...
...

// --------------------- GRADIENT ON / OFF in Folder-page 1 -------------

oLbx50 := TXBrowse():New( oFld:aDialogs[1] )
oLbx50:nMarqueeStyle := MARQSTYLE_HIGHLROW
oLbx50:nColDividerStyle    := LINESTYLE_BLACK
oLbx50:nRowDividerStyle := LINESTYLE_BLACK
oLbx50:SetArray( aHEADGRAD )
oLbx50:aCols[ 1 ]:cHeader = Padr("No.", 3)
oLbx50:aCols[ 2 ]:cHeader = Padr("Style", 20)
oLbx50:nRecSelColor = 15512898
oLbx50:bClrSelFocus = { || { 16777215, 15512898 } }
oLbx50:bClrSel = { || { 16777215, 15512898 } }
oLbx50:lHScroll := .F.
oLbx50:lVScroll := .F.
oLbx50:lFooter := .T.
oLbx50:nFooterHeight := 15

// I get the value for < nHEADGRAD > for page 2
// and enable / disable 2 browsers in page 1

oLbx50:bLClicked := { | nRow, nCol | ( nHEADGRAD := oLbx50:nRowSel, ;
IIF( nHEADGRAD = 2, ;
   ( oLbx3:Disable(), oLbx5:Disable(), ;
     BRW_DISABL(oLbx3), BRW_DISABL(oLbx5), ;
     NEW_HPAINT(oLbx0), NEW_FPAINT(oLbx0) ), ;
   ( oLbx3:Enable(), oLbx5:Enable(), ;
     BRW_ENABL(oLbx3), BRW_ENABL(oLbx5), ;
     NEW_HPAINT(oLbx0), NEW_FPAINT(oLbx0) ) ) ) }

oLbx50:aCols[ 2 ]:AddResource("Green")
oLbx50:aCols[ 2 ]:AddResource("Red")
oLbx50:aCols[ 2 ]:bBmpData := {|| oLbx50:nArrayAt }
oLbx50:aCols[ 2 ]:bStrData := {|| oLbx50:aRow[2] }   

oLbx50:nArrayAt := 1
oLbx50:nRowSel := 1

oLbx50:CreateFromResource( 150 )


//------  ENABLE / DISABLE the 1. Browser in Folderpage 2 -------//

STATIC FUNCTION TEST_FOLD( nOption, nOldOption )

IF nOption == 2
   IF nHEADGRAD = 1
       oLbx6:Disable()
       BRW_DISABL(oLbx6)
   ELSE
      oLbx6:Enable()
      BRW_ENABL(oLbx6)
   ENDIF
ENDIF

RETURN .T.

// ------- GREY painting for DISABLED ----------------------------------

FUNCTION BRW_DISABL(oLbx)

i := 1
FOR i := 1 TO LEN(oLbx:aCols)
   WITH OBJECT oLbx:aCols[i]
      :bClrHeader := { || { 0, 13750737 } }
      :bClrFooter := { || { 0, 13750737 } }
      :bClrStd = { || { 0, 13750737 } }
   END
NEXT

oLbx:Refresh()

RETURN( NIL )

// --------- WHITE painting for ENABLED --------------------------------

FUNCTION BRW_ENABL(oLbx)

i := 1
FOR i := 1 TO LEN(oLbx:aCols)
   WITH OBJECT oLbx:aCols[i]
      :bClrHeader := { || { 0, 16777215 } }
      :bClrFooter := { || { 0, 16777215 } }
      :bClrStd = { || { 0, 16777215 } }
   END
NEXT

oLbx:Refresh()

RETURN( NIL )



Regards
Uwe :lol:
Last edited by ukoenig on Wed Sep 10, 2008 1:33 am, edited 3 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby James Bott » Wed Sep 10, 2008 1:08 am

Uwe,

Glad to hear you got it working.

>The Switch-var < nHEADGRAD > is PRIVATE

I would avoid PRIVATEs like the plague. Remember they are visible inside any and all functions called by code where they are visible. This includes FWH and (x)Harbour functions too.

It would be better as a file-wide static. [It would be best as class data in a class.]

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

xBrowse-Tools

Postby ukoenig » Wed Sep 10, 2008 1:49 am

James,

thank you very much for your help.
I think it is possible now with this version,
to cover all needed visual-designs for xBrowse.
There are source-results on each page.
I will put them all together as a small MDI - Test-application
with main-window, a dialog and the created browser.

Greetings from Germany
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests