Page 1 of 1

FWH 2006: XBrowse : Own built-in Buttonbar

Posted: Thu Jul 09, 2020 6:03 pm
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.

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

Posted: Thu Jul 09, 2020 7:27 pm
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

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

Posted: Thu Jul 09, 2020 8:10 pm
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

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

Posted: Thu Jul 09, 2020 11:28 pm
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
 

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

Posted: Fri Jul 10, 2020 12:42 pm
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

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

Posted: Fri Jul 10, 2020 12:47 pm
by nageswaragunupudi
xBrowse( oRs )
Change this to

Code: Select all

XBROWSER oRs SHOW RECID

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

Posted: Sat Jul 11, 2020 3:18 pm
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.

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

Posted: Sat Jul 18, 2020 3:04 pm
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

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

Posted: Sat Jul 18, 2020 4:48 pm
by nageswaragunupudi
Yes

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

Posted: Mon Jul 20, 2020 12:48 pm
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
   

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

Posted: Mon Jul 20, 2020 4:43 pm
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

   @ ....
 

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

Posted: Mon Jul 20, 2020 5:33 pm
by Silvio.Falconi
thanks run ok