FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FWH 2006: XBrowse : Own built-in Buttonbar
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Thu Jul 09, 2020 06:03 PM
Now it is possible for each xbrowse to have its own buttonbar inside the control.



Test program:
Code (fw): Select all Collapse
#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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Thu Jul 09, 2020 07:27 PM

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

Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Thu Jul 09, 2020 08:10 PM
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

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Thu Jul 09, 2020 11:28 PM
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 (fw): Select all Collapse
XBROWSER "CUSTOMER.DBF" SHOW RECID


Please add these lines to any of your xbrowses and see.
Code (fw): Select all Collapse
   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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Fri Jul 10, 2020 12:42 PM
Rao

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

Code (fw): Select all Collapse
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Fri Jul 10, 2020 12:47 PM
xBrowse( oRs )


Change this to
Code (fw): Select all Collapse
XBROWSER oRs SHOW RECID
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Sat Jul 11, 2020 03:18 PM
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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Sat Jul 18, 2020 03:04 PM
a work in progress



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 March-April 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Sat Jul 18, 2020 04:48 PM

Yes

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Mon Jul 20, 2020 12:48 PM
nageswaragunupudi wrote:Yes


Sorry,
but I tried with no success


oApp():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 (fw): Select all Collapse
 #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 March-April 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Mon Jul 20, 2020 04:43 PM
Change it like this:

Code (fw): Select all Collapse
function XbrSetupBar( oBrw )

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

   @ ....
Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Mon Jul 20, 2020 05:33 PM

thanks run ok

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 244
Joined: Fri Oct 28, 2005 06:29 PM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Fri Apr 12, 2024 12:20 AM
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 (fw): Select all Collapse
#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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Fri Apr 12, 2024 09:51 AM
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 2006: XBrowse : Own built-in Buttonbar
Posted: Tue Apr 16, 2024 03:34 AM
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 (fw): Select all Collapse
      if nMRow <= ::oBrw:nHeaderHeight  ;


Change this line as:
Code (fw): Select all Collapse
      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

Continue the discussion