FWH 2006: XBrowse : Own built-in Buttonbar

Post Reply
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
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 | Expand

#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: 2668
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: 7134
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
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 | Expand


XBROWSER "CUSTOMER.DBF" SHOW RECID
 


Please add these lines to any of your xbrowses and see.

Code: Select all | Expand

  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: 2668
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 | Expand


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: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

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

Post by nageswaragunupudi »

xBrowse( oRs )


Change this to

Code: Select all | Expand

XBROWSER oRs SHOW RECID
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
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: 7134
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

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

Post by nageswaragunupudi »

Yes
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 7134
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

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 | Expand



 #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
   
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

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

Post by nageswaragunupudi »

Change it like this:

Code: Select all | Expand

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: 7134
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

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

Post by Silvio.Falconi »

thanks run ok
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
TecniSoftware
Posts: 236
Joined: Fri Oct 28, 2005 6:29 pm
Location: Quilmes, Buenos Aires, Argentina

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

Post by TecniSoftware »

Rao

He armado este ejemplo con un rowset pero con la clausula AUTOSORT y no ordena las columnas, solo al colocar // XbrSetupBar( oBrw ) vueve a ordernar, podria verificar si es asi o estoy haciendo algo mal ?

Muchas gracias.

Code: Select all | Expand

#include "fivewin.ch"

static aStr := { "208.91.198.197:3306,fwhdemo,gnraofwh,Bharat@1950", ;
                 "209.250.245.152,fwh,fwhuser,FiveTech@2022" }

static oCn

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

function Main()
   local oDlg, oFont, oBrw
   local oRs, cSql

   FWSetLanguage( 1 )
   FW_SetUnicode( .t. )

   if ( oCn := maria_Connect( aStr[ 1 ], .t. ) ) = nil
      Return NIL
   EndIf

      TEXT INTO cSql
         SELECT C.ID AS CustID, C.FIRST AS CustName, C.AGE AS AG, C.STATE AS ST, S.NAME AS StateName
         FROM customer C
         LEFT OUTER JOIN states S ON C.STATE = S.CODE
         ORDER BY CUSTID
      ENDTEXT

      oRs := oCn:RowSet( cSql )

   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,400 PIXEL OF oDlg ;
      DATASOURCE oRs AUTOSORT AUTOCOLS CELL LINES NOBORDER

   XbrSetupBar( oBrw ) // Si lo anulo, funciona el AUTOSORT

   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
 
Alejandro Cebolido
Buenos Aires, Argentina
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

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

Post by nageswaragunupudi »

He armado este ejemplo con un rowset pero con la clausula AUTOSORT y no ordena las columnas, solo al colocar // XbrSetupBar( oBrw ) vueve a ordernar, podria verificar si es asi o estoy haciendo algo mal ?
Yes. This is a bug.
Thanks a lot for pointing out.
We are going to look into it and get back soon.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

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

Post by nageswaragunupudi »

He armado este ejemplo con un rowset pero con la clausula AUTOSORT y no ordena las columnas, solo al colocar // XbrSetupBar( oBrw ) vueve a ordernar, podria verificar si es asi o estoy haciendo algo mal ?
Please modify xbrowse and apply this fix.
Please locate this line in the
METHOD HeaderLButtonUp( nMRow, nMCol, nFlags ) CLASS TXBrwColumn

Code: Select all | Expand

      if nMRow <= ::oBrw:nHeaderHeight  ;


Change this line as:

Code: Select all | Expand

      if nMRow < ::oBrw:HeaderHeight( .t. )  ;
This is fixed in the next version under relase.
Thanks for pointing out the bug.
Regards

G. N. Rao.
Hyderabad, India
Post Reply