FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour A question about Dialog ON INIT and xBrowse
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
A question about Dialog ON INIT and xBrowse
Posted: Tue Sep 16, 2008 11:41 AM
Hello,

I finished testing the xBrowse-tools.
I have a question about including PEN-styles inside
the xBrowse-structure.
PEN-defines, i can get working only with Dialog ON INIT
Is there a reason for it and maybe another way, to include this inside the structure ?



FUNCTION Test_Browse5()
Local oDlg5, oLbx30, oBrush5, oBmp5
Local cAlias := cGetNewAlias( "CUST" )
nFOR := 1

REQUEST DBFCDX
USE CUSTOMER NEW ALIAS (cAlias) SHARED VIA "DBFCDX"
GO TOP

DEFINE DIALOG oDlg5 RESOURCE "TESTSOURCE"  

oLbx30 := TXBrowse():New( oDlg5 )

// Here it doesn't work
//oLbx30:hColPen := CreatePen( PS_SOLID, BR_PEN, PEN_COLOR )
//oLbx30:hRowPen := CreatePen( PS_SOLID, BR_PEN, PEN_COLOR )

oCol := oLbx30:AddCol()
oCol:bStrData  := { || (cAlias)->First}
oCol:cHeader   := "First"
oCol:cFooter  := "First"
....
....
....
Lbx30:SetRDD()

// Here it doesn't work
//oLbx30:hColPen := CreatePen( PS_SOLID, BR_PEN, PEN_COLOR )
//oLbx30:hRowPen := CreatePen( PS_SOLID, BR_PEN, PEN_COLOR )

oLbx30:CreateFromResource( 110 )

ACTIVATE DIALOG oDlg5 CENTERED ON INIT OBRW_PEN( oLbx30)

(cAlias)->( dbCloseArea() )

RETURN ( NIL )   

// ----------- IT works only ON INIT ----------------------------------

STATIC FUNCTION OBRW_PEN( oLbx30)

oLbx30:hColPen := CreatePen( PS_SOLID, BR_PEN, PEN_COLOR )
oLbx30:hRowPen := CreatePen( PS_SOLID, BR_PEN, PEN_COLOR )

RETURN( NIL )



//-------------- The resource-part of sample TESTXBR3.prg ------------//
//  It seems, it has to be ON INIT it works as well

static function RddBrwRes()

local oDlg, oBrw, oCol, cAlias := cGetNewAlias( "CUST" )

cFunc := ProcName( 0 )

USE CUSTOMER NEW ALIAS (cAlias) SHARED VIA "DBFCDX"
SET ORDER TO TAG FIRST
GO TOP
MakeTotal()

DEFINE DIALOG oDlg RESOURCE "TEST" //FONT WndMain():oFont

REDEFINE XBROWSE oBrw ID 101 OF oDlg ;
      COLUMNS "First", "Salary" ;
      FIELDS (cAlias)->State, (cAlias)->Age ;
      HEADERS nil, nil, "State", "AGE" ;
      JUSTIFY .F., nil, .F., .T. ;
      ALIAS cAlias AUTOSORT LINES CELL

ADD TO oBrw DATA (cAlias)->CITY HEADER "City" CARGO { 1, 2 }

AEVAL( oBrw:aCols, { |o| o:bPopUp := { |o| ColMenu( o ) } } )
AEval( oBrw:aCols, { |o| o:cToolTip := { 'Column :' + CRLF + o:cHeader, 'ToolTip' } } )
   
ACTIVATE DIALOG oDlg CENTERED ON INIT ( OBRW_PEN( oBrw ), oBrw:SetFocus() )

(cAlias)->( dbCloseArea() )

return nil

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

STATIC FUNCTION OBRW_PEN( oBrw )

oBrw:hColPen := CreatePen( PS_SOLID, 5, 128 )
oBrw:hRowPen := CreatePen( PS_SOLID, 5, 128 )

RETURN( NIL )
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.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
A question about Dialog ON INIT and xBrowse
Posted: Tue Sep 16, 2008 01:16 PM

Uwe,

>PEN-defines, i can get working only with Dialog ON INIT
>Is there a reason for it and maybe another way, to include this inside the structure ?

If you look at the xbrowse source, the pens are defined in the Adjust() method which is called from the Initate() method. So, you can't define them before the browse is intiatated, because they will just get overwritten by the pen definitions in the Adjust() method. Unfortunately, bInit is never eval'd in xBrowse so you can't use that either.

So, the solution you found seems to be the only one (short of modifying the xbrowse source).

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Mini-project of xBrowse
Posted: Tue Sep 16, 2008 03:17 PM
James,
Thank you very much for the information.

The rest of the job is done.

Now the user can generate a mini-project of his xbrowse-creations.

For users FWH Version >= 8.07


For users FWH Version < 8.07


Regards
Uwe :-)
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.

Continue the discussion