FWH 2006: XBrowse : Own built-in Buttonbar

Post Reply
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

FWH 2006: XBrowse : Own built-in Buttonbar

Post by nageswaragunupudi »

Now it is possible for each xbrowse to have its own buttonbar inside the control.

Image

Test program:

Code: Select all

#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oDlg, oFont, oBrw

   USE CUSTOMER NEW SHARED VIA "DBFCDX"
   USE STATES   NEW SHARED VIA "DBFCDX"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 600,470 PIXEL TRUEPIXEL RESIZABLE FONT oFont ;
      TITLE "XBROWSE : BUILT-IN BUTTON BAR"

   @  20,20 XBROWSE oBrw SIZE -20,200 PIXEL OF oDlg ;
      DATASOURCE "STATES" AUTOCOLS CELL LINES NOBORDER

   XbrSetupBar( oBrw )

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      :SetChecks()
      //
      :CreateFromCode()
   END

   @ 250,20 XBROWSE oBrw SIZE -20,200 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" AUTOCOLS CELL LINES NOBORDER

   XbrSetupBar( oBrw )

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      :SetChecks()
      //
      :CreateFromCode()
   END


   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

function XbrSetupBar( oBrw )

   oBrw:nTopBarHeight := 30
   oBrw:bOnAdjust := <||
      local oBtn
      @ 05,05 BTNBMP oBtn FILE "..\bitmaps\16X16\new.bmp" SIZE 30,20 PIXEL OF oBrw NOBORDER ;
        ACTION oBrw:EditSource( .t. ) TOOLTIP "Add New Record"
      @ 05,45 BTNBMP oBtn FILE "..\bitmaps\edit.bmp" SIZE 30,20 PIXEL OF oBrw NOBORDER ;
        ACTION oBrw:EditSource() TOOLTIP "Edit this record"
      @ 05,85 BTNBMP oBtn FILE "..\bitmaps\16x16\delete.bmp" SIZE 30,20 PIXEL OF oBrw NOBORDER ;
        ACTION If( MsgNoYes( "Delete this row?" ),,oBrw:Delete() ) TOOLTIP "Delete This Record"

      return nil
      >

return nil
 
If we specify oBrw:nTopBarHeight, the browse leaves a blank space on the top with this height. We can place our own buttons or some other controls specific to the browse in this area.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: FWH 2006: XBrowse : Own built-in Buttonbar

Post by Rick Lipkin »

Rao

I have mentioned this before .. When I create a Dataset be it .dbf or oRs .. I would like the xBrowse() class to show a footer with the record pointer and number of records .. It would be so helpful in debugging to know how many records were fetched ...

Thanks
Rick Lipkin
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: FWH 2006: XBrowse : Own built-in Buttonbar

Post by Silvio.Falconi »

Nages, if you press on header of xbrowse with the left button of the mouse , you'll see the name of the column into TopBar

Image
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 2006: XBrowse : Own built-in Buttonbar

Post by nageswaragunupudi »

Rick Lipkin wrote:Rao

I have mentioned this before .. When I create a Dataset be it .dbf or oRs .. I would like the xBrowse() class to show a footer with the record pointer and number of records .. It would be so helpful in debugging to know how many records were fetched ...

Thanks
Rick Lipkin
This was implemented long back.
Please try

Code: Select all

XBROWSER "CUSTOMER.DBF" SHOW RECID
 
Please add these lines to any of your xbrowses and see.

Code: Select all

   WITH OBJECT oBrw
      :lFooter       := .t.
      :bRecSelHeader := { || "RecID" }
      :bRecSelData   := { |o| Int( o:BookMark ) }
      :bRecSelFooter := { |o| o:nLen }
      :nRecSelWidth  := Replicate( '9', Len( cValToChar( Eval( oBrw:bKeyCount, oBrw ) ) ) + 2 )
   END
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: FWH 2006: XBrowse : Own built-in Buttonbar

Post by Rick Lipkin »

Rao

Thanks for your answer .. typically I use xBrowse() for debugging database fetch results .. like this:

Code: Select all

oRs := TOleAuto():New( "ADODB.Recordset" )
oRs:CursorType     := 1        // opendkeyset
oRs:CursorLocation := 3        // local cache
oRs:LockType       := 3        // lockoportunistic

cSQL := "SELECT [Persno],[TFormEID],[CurrFY],[PrevFY],[CreateDT],[FiscalYr],[ContEdCr],[HowMany], [GrandTot], "
cSql += "[CurrHrs],[CurrCont],[PrevHrs],[PrevCont],[Fanswer],[FDate] "
cSql += "from Request Where [Persno] = '"+cPersno+"' and [Fanswer] = 'APPROVED' order by [CreateDt]"

TRY
   oRs:Open(cSQL,xConnect )
CATCH oErr
   Saying := "Error in Opening REQUEST table to complete"+chr(10)
   Saying += "Fiscal Year Continuing Education"
   Msginfo( Saying )
   RETURN(.F.)
END TRY

xBrowse( oRs )   // here is where I would like to see a total number of records fetched based on the Sql parameters ..

oRs:close()

 
Thanks
Rick Lipkin
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 2006: XBrowse : Own built-in Buttonbar

Post by nageswaragunupudi »

xBrowse( oRs )
Change this to

Code: Select all

XBROWSER oRs SHOW RECID
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 2006: XBrowse : Own built-in Buttonbar

Post by nageswaragunupudi »

Silvio.Falconi wrote:Nages, if you press on header of xbrowse with the left button of the mouse , you'll see the name of the column into TopBar
Thanks.
Fixed in FWH2007.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: FWH 2006: XBrowse : Own built-in Buttonbar

Post by Silvio.Falconi »

a work in progress

Image

Nages,
can I insert also a comboBox control ?

the text od datasource can be different from area ?
sample dbf := clie001.dbf aREA := CL TEXT := CLIENTI
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 2006: XBrowse : Own built-in Buttonbar

Post by nageswaragunupudi »

Yes
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: FWH 2006: XBrowse : Own built-in Buttonbar

Post by Silvio.Falconi »

nageswaragunupudi wrote:Yes
Sorry,
but I tried with no success


oApp():oGrid:bOnAdjust := <||

local oBtn,oCbx1
local cFilter1:= val(alistini[1][1])

local nrow:= 05
local ncol:= 05

@ nrow,ncol COMBOBOX oCbx1 VAR cFilter1 ITEMS ArrTranspose( aListini )[ 1] ;
SIZE 120,400 PIXEL OF oApp():oGrid


return nil
>


give me this error on compilation

source\spiaggia\PTariffe.prg(631) Error E0005 Outer codeblock variable 'CFILTER1' is out of reach

why ????


try this ( it is your sample I add a combox to search state )

Code: Select all


 #include "fivewin.ch"

    REQUEST DBFCDX

    function Main()

       local oDlg, oFont, oBrw

       USE CUSTOMER NEW SHARED VIA "DBFCDX"
       USE STATES   NEW SHARED VIA "DBFCDX"

       DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
       DEFINE DIALOG oDlg SIZE 600,470 PIXEL TRUEPIXEL RESIZABLE FONT oFont ;
          TITLE "XBROWSE : BUILT-IN BUTTON BAR"

       @  20,20 XBROWSE oBrw SIZE -20,200 PIXEL OF oDlg ;
          DATASOURCE "STATES" AUTOCOLS CELL LINES NOBORDER

       XbrSetupBar( oBrw )

       WITH OBJECT oBrw
          :nEditTypes    := EDIT_GET
          :SetChecks()
          //
          :CreateFromCode()
       END

       @ 250,20 XBROWSE oBrw SIZE -20,200 PIXEL OF oDlg ;
          DATASOURCE "CUSTOMER" AUTOCOLS CELL LINES NOBORDER

       XbrSetupBar( oBrw )

       WITH OBJECT oBrw
          :nEditTypes    := EDIT_GET
          :SetChecks()
          //
          :CreateFromCode()
       END


       ACTIVATE DIALOG oDlg CENTERED
       RELEASE FONT oFont

    return nil

    function XbrSetupBar( oBrw )

       oBrw:nTopBarHeight := 30
       oBrw:bOnAdjust := <||
       local oBtn
       local oCbx,nshow
       local aState := { ;
                  "AK",;
                  "AL",;
                  "AR",;
                  "AZ",;
                  "CA",;
                  "CO",;
                  "CT",;
                  "DE",;
                  "FL",;
                  "GA",;
                  "HI",;
                  "IA",;
                  "ID",;
                  "IL",;
                  "IN",;
                  "KS",;
                  "KY",;
                  "LA",;
                  "MA",;
                  "MD",;
                  "ME",;
                  "MI",;
                  "MN",;
                  "MO",;
                  "MS",;
                  "MT",;
                  "NC",;
                  "ND",;
                  "NE",;
                  "NH",;
                  "NJ",;
                  "NM",;
                  "NV",;
                  "NY",;
                  "OH",;
                  "OK",;
                  "OR",;
                  "PA",;
                  "RI",;
                  "SC",;
                  "SD",;
                  "TN",;
                  "TX",;
                  "UT",;
                  "VA",;
                  "VT",;
                  "WA",;
                  "WI",;
                  "WV",;
                  "WY" }

           @ 05,05 COMBOBOX oCbx Var nShow Items aState  SIZE 30,20 PIXEL OF oBrw

          return nil
          >

    return nil
   
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 2006: XBrowse : Own built-in Buttonbar

Post by nageswaragunupudi »

Change it like this:

Code: Select all

function XbrSetupBar( oBrw )

   local nshow
   local aState := { ;
              "AK", .......... }
   
   oBrw:nTopBarHeight := 30
   oBrw:bOnAdjust := <||
      local oBtn
      local oCbx

   @ ....
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: FWH 2006: XBrowse : Own built-in Buttonbar

Post by Silvio.Falconi »

thanks run ok
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply