A question about Dialog ON INIT and xBrowse

A question about Dialog ON INIT and xBrowse

Postby ukoenig » 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 ?

Image

Code: Select all  Expand view

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby James Bott » Tue Sep 16, 2008 1: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Mini-project of xBrowse

Postby ukoenig » Tue Sep 16, 2008 3: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
Image

For users FWH Version < 8.07
Image

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 66 guests