FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBrowse Win7 Bar New Sample
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse Win7 Bar New Sample
Posted: Mon Jan 03, 2011 02:00 PM
Mr. Silvio

Before you use
Code (fw): Select all Collapse
oApp():oGrid:SetBackGround("c:\work\fwh\bitmaps\five.bmp", 1 )

you must have already assigned the datasource ( cAlias, oRs,oDbf. etc. with methods like SetRDD/SetADO,etc and preferably define atleast some columns ).
My advice is that the datasource be defined soon after creating the xbrowse.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse Win7 Bar New Sample
Posted: Mon Jan 03, 2011 02:07 PM
Addressing a limited point.

Code (fw): Select all Collapse
MyBrowse( oData,aColumns,aHeaders, aSizes,aPictures,xRights,aSearch,bOnLClick,aM_Bitmaps)

   <code>
    @ 0,0 XBROWSE oBrw OF oWnd DATASOURCE oData ;
           COLUMNS aColumns HEADERS aHeaders ;
           SIZES aSizes PICTURES aPictures ;
           CELL LINES
    WITH OBJECT oBrw
         <code>
          :AddBitmap( aM_Bitmaps )
         <othercode>
     END
     <othercode>
return nil

Yes. Some of the parameters can be NIL also.
Regards



G. N. Rao.

Hyderabad, India
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: XBrowse Win7 Bar New Sample
Posted: Tue Jan 04, 2011 10:29 AM
MR RAO,

I made :
// OPEN DATABASE
oDHard:=Apri_dbf("Hardware",.T.,.T.,aIdx)
(oDHard)->(OrdSetFocus(2))

// CREATE Dialog and XBROWSE
oApp():oDlg := TMia():New(oApp():oWndMain)
oApp():cTitle := i18n('Gestione Hardware')
oApp():SetColor(0,RGB(143,172,230))
oApp():oClient := oApp():oDlg
oApp():NewGrid7( nSplit )


// INSERT COLUMNS

oCol:= oApp():AddCol()
oCol:AddResource("sort3")
oCol:AddResource("sort4")
oCol:AddResource( 'TREE_AULE')
oCol:bBmpData := { || 3 }
oCol:bStrData := { || ( oDHard)->Laboratory}
oCol:cHeader := "Aula/lab"
oCol:nWidth :=120
oCol:nHeadBmpNo := 1
oCol:nHeadBmpAlign := AL_RIGHT
oCol:oDataFont := oFontGrid
oCol:bLClickHeader :={ ||(Sel_Index(1,oDHard) , oApp():=1,oApp():refresh()) }



.......
( the other columns)
......

WITH OBJECT oApp():oGrid
:nMarqueeStyle = 7 // MARQSTYLE_HIGHLWIN7 // for Windows 7 style

END

oApp():SetBackGround("c:\work\fwh\bitmaps\five.bmp", 1 )

oApp():CreateFromCode()

oApp():nRowHeight :=40
oApp():nHeaderHeight := 36


IT MAKE ERROR


I TRIED TO INSERT
oApp():SetBackGround("c:\work\fwh\bitmaps\five.bmp", 1 )

ALSO AFTER THE COMMAND oApp():CreateFromCode()

BUT IT MAKE THE SAME ERROR
Best Regards, Saludos



Falconi Silvio
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse Win7 Bar New Sample
Posted: Tue Jan 04, 2011 12:24 PM

Mr. Silvio
As I advised, please set the datasource by one of the appropriate methods like SetRDD() or SetODBF() soon after creating the XBrowse.

Regards



G. N. Rao.

Hyderabad, India
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: XBrowse Win7 Bar New Sample
Posted: Tue Jan 04, 2011 12:46 PM
YES NOW RUN OK
THANKS
Best Regards, Saludos



Falconi Silvio
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: XBrowse Win7 Bar New Sample
Posted: Tue Jan 04, 2011 01:34 PM

Adolfo,

OK, but instead of "real browses" I would refer to them as "complex browses." Granted many, if not most, will be too complex to completely define with a single command line.

Regarding OJB size, I am guessing that what Rao was refering to is not just TBRows():new() but rather trying to eliminate some of the other OOP syntax lines of code. There is a lot of code built into the xbrowse class that is used when you make command line specifications. When this is utilized, then you can eliminate some of the other OOP syntax. This would eliminate some lines of code in the app because code in the class handles it. This would create a smaller OBJ, but not much smaller, I would think. If you had dozens of browses, then maybe the size reduction would be more significant.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: XBrowse Win7 Bar New Sample
Posted: Tue Jan 04, 2011 01:38 PM

Rao,

Please explain the advantage of using TXBrow() instead of TXBrowse():New(). I see that TXBrow() uses a codeblock to call TXBrowse() but I don't understand what the significance of that is.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: XBrowse Win7 Bar New Sample
Posted: Wed Jan 05, 2011 09:00 AM

Hello,

Mr. Rao, can you please indicate how to modify those methods in xbrowse.prg?.

Thank you.

METHOD Adjust()
METHOD FullPaint() INLINE ( ::lTransparent .or. ::lMergeVert .or. ::nMarqueeStyle == MARQSTYLE_HIGHLWIN7 )
METHOD DrawLine( lSelected, nRowSel )

FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: XBrowse Win7 Bar New Sample
Posted: Wed Jan 05, 2011 11:02 AM

NO you must copy the subclass Txbrowse7win Rao made
Go to thr first messageof this topic

FWH .. BC582.. xharbour
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: XBrowse Win7 Bar New Sample
Posted: Wed Jan 05, 2011 11:07 AM

Mr. Mda,

I prefer to modify xbrowse.prg as I have more than 200 Xbrowses!!!.

I don´t know where to place the modifications in xbrowse.org (at the beginning or end of methods).

Thank you.

FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: XBrowse Win7 Bar New Sample
Posted: Wed Jan 05, 2011 03:01 PM

UKService,

All you need to do is to add the new class to your app and then change xbrowse.ch to call the new class instead of TXBrowse().

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse Win7 Bar New Sample
Posted: Wed Jan 05, 2011 04:04 PM
James Bott wrote:UKService,

All you need to do is to add the new class to your app and then change xbrowse.ch to call the new class instead of TXBrowse().

Regards,
James

Mr. James and Mr. UKService

We do NOT need to change anything in xbrowse.ch or anywhere else in the libraries at all.

Just write one line of code at the beginning of the application:
Code (fw): Select all Collapse
SET XBROWSE TO TXbrWin7()

or
Code (fw): Select all Collapse
SetXBrowse( { || TXBrWin7() } )


This is the only one line to be added at the beginning of the application. NO OTHER CHANGES.

Conditions:
1. Works perfectly where browses are created by command syntax.
2. Or if Oops style is used browses are created by oBrw := TXBrows():New(...) but not TXBrowse():New() (As recommended by FWH)

XBrowse libraries and architecture are specially built to facilitate use of inherited classes without any changes in the commands or libraries.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse Win7 Bar New Sample
Posted: Wed Jan 05, 2011 04:06 PM
James Bott wrote:Rao,

Please explain the advantage of using TXBrow() instead of TXBrowse():New(). I see that TXBrow() uses a codeblock to call TXBrowse() but I don't understand what the significance of that is.

Regards,
James

Mr. James

I hope my earlier posting answers your question.
FWH advises to use TXBrows():New() or command sytax, so that using inherited classes is made extremely simple.

This architecture is devised and implemented keeping in view that real life applications may have hundreds of browses and it is difficult to keep making changes in hundreds of places.
Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: XBrowse Win7 Bar New Sample
Posted: Wed Jan 05, 2011 05:58 PM
Rao,

2. Or if Oops style is used browses are created by oBrw := TXBrows():New(...) but not TXBrowse():New() (As recommended by FWH)


OK, I see the advantage of using this syntax. However, for UKService, assuming he is currently using TXBrowse():New(), he would have to change all 200 of these to the TBrow() syntax. If he were to change the xbrowse.ch file, then he only needs to make one change.

Also, you refer to TXBrow():New() but TXBrow is a function so the proper syntax is just TXBrow() is that not correct? Further it only seems to accept a single codeblock as a parameter, so I don't understand how this is used.

Regards,
James

Code (fw): Select all Collapse
Function TXBrows( bChild )

   if bXBrowse == nil
      bXBrowse    := { || TXBrowse() }
   endif

   if ValType( bChild ) == 'B' .and. ; // retained for backward compatibility
      ValType( Eval( bChild ) ) == 'O' .and. ;
      Eval( bChild ):IsKindOf( TXBrowse() )

      bXBrowse    := bChild
   endif

return Eval( bXBrowse )
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse Win7 Bar New Sample
Posted: Wed Jan 05, 2011 06:39 PM
OK, I see the advantage of using this syntax. However, for UKService, assuming he is currently using TXBrowse():New(), he would have to change all 200 of these to the TBrow() syntax. If he were to change the xbrowse.ch file, then he only needs to make one change.

Also, you refer to TXBrow():New() but TXBrow is a function so the proper syntax is just TXBrow() is that not correct? Further it only seems to accept a single codeblock as a parameter, so I don't understand how this is used.

TXBrows():new(oWnd) // not TXBrow()

It is easier to change "TXBrowse(" to "TXBrows(" in one stroke in all sources with a single operation with any program editor. Anyway we are changing to what FWH recommends.

Changing xbrowse.ch does not help. It calls functions. FWH library never internally uses TXBrowse():new() to construct xbrowse. Even internally it calls only TXBrows():New()

I can assure you that this system is quite robust and works perfectly.

Use either command syntax or TXBrows():New().

You can use any derived class for the whole application or different derived c;asses fpr different browses, everything works smoothly.

CaveAt: Resources need to be changed.
Regards



G. N. Rao.

Hyderabad, India