FWH 2006: XBrowse : Own built-in Buttonbar

FWH 2006: XBrowse : Own built-in Buttonbar

Postby nageswaragunupudi » Thu Jul 09, 2020 6:03 pm

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

Image

Test program:
Code: Select all  Expand view
#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
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Rick Lipkin » Thu Jul 09, 2020 7: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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

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

Postby Silvio.Falconi » Thu Jul 09, 2020 8: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

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
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

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

Postby nageswaragunupudi » 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: Select all  Expand view

XBROWSER "CUSTOMER.DBF" SHOW RECID
 


Please add these lines to any of your xbrowses and see.
Code: Select all  Expand view
  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
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Rick Lipkin » Fri Jul 10, 2020 12:42 pm

Rao

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

Code: Select all  Expand view

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
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

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

Postby nageswaragunupudi » Fri Jul 10, 2020 12:47 pm

xBrowse( oRs )


Change this to
Code: Select all  Expand view
XBROWSER oRs SHOW RECID
Regards

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

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

Postby nageswaragunupudi » Sat Jul 11, 2020 3: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
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Silvio.Falconi » Sat Jul 18, 2020 3:04 pm

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
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

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

Postby nageswaragunupudi » Sat Jul 18, 2020 4:48 pm

Yes
Regards

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

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

Postby Silvio.Falconi » Mon Jul 20, 2020 12:48 pm

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 view


 #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
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

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

Postby nageswaragunupudi » Mon Jul 20, 2020 4:43 pm

Change it like this:

Code: Select all  Expand view
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
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Silvio.Falconi » Mon Jul 20, 2020 5:33 pm

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
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

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

Postby TecniSoftware » 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: Select all  Expand view

#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
TecniSoftware
 
Posts: 235
Joined: Fri Oct 28, 2005 6:29 pm
Location: Quilmes, Buenos Aires, Argentina

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

Postby nageswaragunupudi » Fri Apr 12, 2024 9: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
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby nageswaragunupudi » Tue Apr 16, 2024 3: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: Select all  Expand view
     if nMRow <= ::oBrw:nHeaderHeight  ;


Change this line as:
Code: Select all  Expand view
     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
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Natter and 68 guests