To Mr. Rao

To Mr. Rao

Postby Armando » Sat Jan 07, 2017 5:19 pm

Mr. Rao:

Where I can find an example to use xbrowse with recordset, not with arrays.

My tolos, FWH 1507, Harbour and BCC5.5

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: To Mr. Rao

Postby Rick Lipkin » Sat Jan 07, 2017 5:46 pm

Armando

There are many variants and ways to create xBrowse and Rao is certainly the Master .. here is an example that is a MdiChild\xBrowse that has has a few neat ideas .. notice how you can control the xBrowse frame colors with oLbx:bClrGrad ..

Basically, define RECORDSET oRs in your xBrowse .. and use all the usual xBrowse methods ..

Rick Lipkin

Code: Select all  Expand view  RUN

If cMode = "V"
   cTITLE := "DRIVERS Records Browse for Agency "+xAGENCY+" -- READ ONLY"
Else
   cTITLE := "DRIVERS Records Browse for Agency "+xAGENCY
Endif

DEFINE ICON oICO RESOURCE "CROWN"

DEFINE WINDOW oWndChild     ;
       MDICHILD             ;
       NOZOOM               ;
       NOMINIMIZE           ;
       FROM 0,1 to 32,98    ;
       ICON oICO            ;
       OF oWnd              ;
       TITLE cTitle

DEFINE DIALOG oDlg RESOURCE "DRVRBROW" of oWndChild

       REDEFINE xBROWSE oLBX             ;
       RECORDSET oRsDrv                  ;
       COLUMNS "LNAME",                  ;
               "FNAME",                  ;
               "LICENSE",                ;
               "TRAIN1",                 ;
               "TRAIN2",                 ;
               "ACTIVE"                  ;
       COLSIZES 150,150,100,80,80,50     ;
       HEADERS "Lname",                  ;
               "Fname",                  ;
               "Drv License",            ;
               "Drv Train",              ;
               "Adv Train",              ;
               "Active"                  ;
       ID 111 of oDlg                    ;
       AUTOSORT AUTOCOLS LINES CELL

   oLbx:lHScroll := .f. // turn off horiz scroll bar
   oLbx:nMarqueeStyle := MARQSTYLE_HIGHLROW
   oLbx:lRecordSelector := .f.


   oCol1 := oLbx:aCols[ 4 ]
   oCol1:bStrData := { |x| x := if(oRsDrv:eof, ,TtoDate(oRsDrv:Fields("Train1"):Value)),;
                                     If( Empty(x), ctod(""),x ) }
   oCol2 := oLbx:aCols[ 5 ]
   oCol1:bStrData := { |x| x := if(oRsDrv:eof, ,TtoDate(oRsDrv:Fields("Train2"):Value)),;
                                     If( Empty(x), ctod(""),x ) }

   oLbx:lFooter   := .t.
   oCol           := oLbx:aCols[ 1 ]
   oCol:bFooter   := { || Ltrim( Str( oLbx:KeyNo() ) ) + " / " + LTrim( Str( oLbx:KeyCount() ) ) }
   oLbx:bChange   := { || oCol:RefreshFooter() }


   oLbx:bClrGrad := { | lInvert | If( ! lInvert, ;
                    { { 0.50, 15790320, 15790320 }, ;
                    { 0.50,   15790320, 15790320 } }, ;
                    { { 0.50, 15790320, 15790320 }, ;
                    { 0.50,   15790320, 15790320 } } ) }

   oLbx:aCols[4]:nDataStrAlign := AL_LEFT
   oLbx:aCols[4]:nHeadStrAlign := AL_LEFT

   oLbx:aCols[5]:nDataStrAlign := AL_LEFT
   oLbx:aCols[5]:nHeadStrAlign := AL_LEFT

   oLbx:bLDblClick := { |nRow,nCol | _Drvrview( "V",oRsDrv,oBtn1,oBtn2,oBtn3,oBtn4,oBtn5 ) }
   
    _BrowColor( oLbx )

   REDEFINE BTNBMP oBTN1 ID 113           ;
       RESOURCE "ADD16","DADD16","DADD16" ;
       PROMPT "&Add" LEFT 2007;
       ACTION ( _Drvrview("A",oRsDrv,oBtn1,oBtn2,oBtn3,oBtn4,oBtn5 ),; // add
                          oLBX:ReFresh(),( oLbx:SetFocus(), .F. ) ) ;
       GRADIENT GreyButtonGrad()

   REDEFINE BTNBMP oBTN2 ID 114           ;
   RESOURCE "EDIT16","DEDIT16","DEDIT16"    ;
       PROMPT "&Edit" LEFT 2007;
       ACTION ( _Drvrview("E",oRsDrv,oBtn1,oBtn2,oBtn3,oBtn4,oBtn5 ),; // edit
                oLBX:ReFresh(),( oLbx:SetFocus()) );
       GRADIENT GreyButtonGrad()

   REDEFINE BTNBMP oBTN3 ID 115            ;
       RESOURCE "VIEW16","DVIEW16","DVIEW16" ;
       PROMPT "&View" LEFT 2007;
       ACTION ( _Drvrview("V",oRsDrv,oBtn1,oBtn2,oBtn3,oBtn4,oBtn5 ),; // view
                oLBX:ReFresh(),( oLbx:SetFocus(), .F. ) ) ;
       GRADIENT GreyButtonGrad()

   REDEFINE BTNBMP oBTN4 ID 116           ;
       RESOURCE "DELETE16","DDELETE16","DDELETE16" ;
       PROMPT "&Delete" LEFT 2007;
       ACTION ( _DrvrDel( oRsDrv,oLbx ),  ;
                oLBX:ReFresh(),( oLbx:SetFocus(), .F. ) ) ;
       GRADIENT GreyButtonGrad()

   REDEFINE BTNBMP oBTN6 ID 117           ;
       RESOURCE "CAR24","DCAR24","DCAR24" ;
       PROMPT "A&ccident" LEFT 2007;
       ACTION ( _AcciBrow( oRsDrv,oBtn1,oBtn2,oBtn3,oBtn4,oBtn5 )) ;
       GRADIENT GreyButtonGrad()

   REDEFINE BTNBMP oBTN5 ID 112           ;
       RESOURCE "CANCEL","DCANCEL","DCANCEL" ;
       PROMPT "&Quit" LEFT 2007;
       ACTION ( lOK1 := .F., oWndChild:END() ) ;
        GRADIENT GreyButtonGrad()

   ACTIVATE DIALOG oDlg NOWAIT ;
        VALID (!GETKEYSTATE( 27 ))  // do not allow esc key here

ACTIVATE WINDOW oWndChild ;
   ON INIT ( oDlg:Move( 0,0, oWndchild:nWidth, oWndchild:nHeight, .T. ),oLbx:SetFocus(), ;
           oWndChild:bResized := {|| _ReSizeUm( oDlg,oWndChild,oLbx) }, ;
           oDlg:refresh(.t.),oLbx:SetFocus());
   VALID ( IIF( !lOK, _ExitPgm(.T., oRsDrv,oWndChild,@lOk ), .F. ))


Return( .T. )

//-----------------------
Static FUNCTION _ExitPgm( lCLEAN , oRsDrv, oWndchild,lOk )

LOCAL lOK1

lOK1  := .F.


IF lCLEAN = .T.
   lOK  := .T.
   lOK1 := lOK

   try
      oRsDrv:CLose()
   catch
   end try

   oWndChild:End()


ENDIF

RETURN( lOK1 )

 

Image
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: To Mr. Rao

Postby Armando » Sat Jan 07, 2017 7:15 pm

Rick:

Thank you very much for your example, I will try to understand it, and yes Mr. Rao is the master

Maybe there is some example with editing by cells wirh recordset

Best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: To Mr. Rao

Postby Rick Lipkin » Sat Jan 07, 2017 11:07 pm

Armando

Here is some Invoicing code I use .. the key is EDIT_GET .. use the code blocks to create your own code .. Lots going on here .. Let me know if I can help.

Rick Lipkin

Code: Select all  Expand view  RUN

DEFINE ICON oIco RESOURCE "QUICK"

DEFINE WINDOW oWndChildB           ;
       FROM 0,0 to 39,120          ;
       MDICHILD                    ;
       OF oWnd                     ;
       ICON oIco                   ;
       TITLE xTITLE

       DEFINE DIALOG oWorkB RESOURCE "QUIKVIEW" of oWndChildB

       REDEFINE xBROWSE oLBXB        ;
         RECORDSET oRsInvDetail      ;
         COLUMNS "QTY",              ;
                 "INVENTORY ID",     ;
                 "INVENTORY TYPE",   ;
                 "ITEM DESCRIPTION", ;
                 "PRICE",            ;
                 "LOCATION",         ;
                 "COVERED BY WARRANTY", ;
                 "SCRAPPED"          ;
         COLSIZES 45,115,55,300,65,80,50,55   ;
         HEADERS "Qty",              ;
                 "Part Number",      ;
                 "Type",             ;
                 "Description",      ;
                 "Price",            ;
                 "Location",         ;
                 "Warranty",         ;
                 "Scrapped"          ;
         ID 172 of oWorkB            ;
       AUTOCOLS LINES CELL FASTEDIT

       AEval( oLbxB:aCols, { |o| o:nEditType := EDIT_GET } )

          // row numbers  
       ADD oCol to oLbxB AT 1 DATA oLbxB:KeyNo() HEADER 'Ln' size 23 //PICTURE '9999'
       oLbxB:aCols[1]:nDataStrAlign := AL_LEFT
       oLbxB:aCols[1]:nHeadStrAlign := AL_LEFT

       WITH OBJECT oLbxB
            :lTabLikeExcel := .t.
       END


       // row number
       oLbxB:aCols[1]:nEditType := EDIT_NONE

       // qty
       oLbxB:aCols[2]:bOnPostEdit := {|o,v| If(_ChkSerial( v,oRsInvDetail,oLbxB),;
           _InvtLook( v, oRsInvDetail, oRsInv, "2", oLbxB, @lTaxable,oTaxable,cLoc,;
           oLabor,oParts,oMisc,oTax,oTotal,cTaxSet,oOther,oSubtotal,"",nRepairNumber,nAssignedTo), ) }

       // part number
       oLbxB:aCols[3]:bOnPreEdit  := { || If(oRsInvDetail:Fields("Inventory Id"):Value = "  ", , __Keyboard( Chr( VK_HOME ))) }
       oLbxB:aCols[3]:bOnPostEdit := {|o,v| _InvtLook( v, oRsInvDetail, oRsInv, "3", oLbxB, @lTaxable, oTaxable, cLoc,;
         oLabor,oParts,oMisc,oTax,oTotal,cTaxSet,oOther,oSubtotal,oRsCust,nRepairNumber,nAssignedTo) }

       // type
       oLbxB:aCols[4]:nEditType    := EDIT_LISTBOX
       oLbxB:aCols[4]:aEditListTxt := aType
       oLbxB:aCols[4]:bOnPostEdit  := {|o,v| _GetPullDown( v,oLbxB,oRsInvDetail ) }

       // description
       oLbxB:aCols[5]:nEditType   := EDIT_GET
     *  oLbxB:aCols[5]:bOnPreEdit  := { || If(oRsInvDetail:Fields("Item Description"):Value = " ", ,;
     *                                __Keyboard( Chr( VK_HOME )) )}
       oLbxB:aCols[5]:bOnPostEdit := {|o,v| _GetText( v,oLbxB,oRsInvDetail ) }

       // labor
       ADD oCol to oLbxB AT 6 HEADER 'Labor' size 50     //60
       oLbxB:aCols[ 6 ]:nEditType  := EDIT_GET_BUTTON
       oLbxB:aCols[ 6 ]:bEditBlock := {|row, col, oCol| ;
                       If(oRsInvDetail:Fields("Inventory Type"):Value = "Labor",;
                       ( nAmount := _LabrBrow( ;
                       nRepairNumber,;
                       aEmp,;
                       aTech,;
                       oRsInvDetail,;
                       "","","","","","I","A",oRsInvDetail:Fields("Key"):Value ),;
                       oRsInvDetail:Fields("Price"):Value := nAmount,;
                       oRsInvDetail:Update()), MsgInfo( "Type is not Labor"))   }  // repair

       oLbxB:aCols[ 6 ]:addbmpfile( "clockview" )
       oLbxB:aCols[ 6 ]:addbmpfile( "clockadd" )
       oLbxB:aCols[ 6 ]:bBmpData := { | lValue | If( oRsInvDetail:Fields("IsLabor"):Value = .t., 1, 2 ) }
    *   oLbxB:aCols[ 6 ]:lBtnTransparent := .t.

       //  Price
       oLbxB:aCols[7]:nEditType := EDIT_GET
       oLbxB:aCols[7]:bOnPostEdit := {|o,p| _GetPrice( p,oLbxB,oRsInvDetail,oRsInv,lTaxable,oTaxable,;
                            oLabor,oParts,oMisc,oTax,oTotal,cTaxSet,oOther,oSubtotal) }

        // extention
       ADD oCol TO oLbxB AT 8 DATA {|x| x :=  _CalcExt( oRsInvDetail:Fields("Qty"):Value,;
                                    oRsInvDetail:Fields("Price"):Value,oRsInvDetail )} HEADER 'Ext' size 65

       oLbxB:aCols[8]:nEditType := EDIT_NONE
       oLbxB:aCols[8]:nDataStrAlign := AL_RIGHT
       oLbxB:aCols[8]:nHeadStrAlign := AL_RIGHT

       // serial number
       ADD oCol to oLbxB AT 9 HEADER 'Serial Num' size 60
       oLbxB:aCols[ 9 ]:nEditType  := EDIT_GET_BUTTON
       oLbxB:aCols[ 9 ]:bEditBlock := {|row, col, oCol| _SerBrow(;
                       nRepairNumber,;
                       oRsInvDetail:Fields("Inventory Id"):Value,;
                       oRsInvDetail:Fields("Qty"):Value,;
                       oRsInvDetail:Fields("Key"):Value,;
                       oRsInvDetail,;
                       oBtn1,oBtn2,oBtn3,oBtn4,oBtn5,"I","A" ) }  // repair

       oLbxB:aCols[ 9 ]:addbmpfile( "zoom2" )
       oLbxB:aCols[ 9 ]:addbmpfile( "adddbf" )
       oLbxB:aCols[ 9 ]:bBmpData := { | lValue | If( oRsInvDetail:Fields("IsSerial"):Value = .t., 1, 2 ) }
     *  oLbxB:aCols[ 9 ]:lBtnTransparent := .t.

       // location
       oLbxB:aCols[10]:nEditType := EDIT_NONE

       // warranty
       oLbxB:aCols[11]:nEditType := EDIT_GET
       if ! empty(oCol := oLbxB:oCol( "WARRANTY" ))
          oCol:SetCheck( { "ON", "OFF" } )
          oCol:cSortOrder  := nil
       endif

       // scrapped
       oLbxB:aCols[12]:nEditType := EDIT_NONE
       if ! empty(oCol := oLbxB:oCol( "SCRAPPED" ))
          oCol:SetCheck( { "ON", "OFF" } )
          oCol:cSortOrder  := nil
       endif

       // add a new record
       oLbxB:bPastEof = {|| _AddNewRow( oRsInvDetail,nRepairNumber,nAssignedTo,cLoc,oLbxB,"N","" ) }

       oLbxB:nColsel(2)

       // boiler plate text

       REDEFINE SAY oSay1  PROMPT "Sales Person"         ID 129 OF oWorkB UPDATE
                    oSay1:SetFont( oFontB )
       REDEFINE SAY oSay2  PROMPT "Inventory Location"   ID 130 OF oWorkB UPDATE
                    oSay2:SetFont( oFontB )
       REDEFINE SAY oSay3  PROMPT "Invoice Date"         ID 132 OF oWorkB UPDATE
                    oSay3:SetFont( oFontB )

       REDEFINE SAY oSay11 ID 146 OF oWorkB UPDATE    // tax set
                    oSay11:SetFont( oFontB )
                    oSay11:SetColor(nRgb(7,7,224))    // blue
       REDEFINE SAY oSay12 ID 133 OF oWorkB UPDATE    // non tax
                    oSay12:SetFont( oFontB )
                    oSay12:SetColor(nRgb(7,7,224))    // blue

       REDEFINE SAY oSay4 PROMPT "Parts" ID 169 OF oWorkB UPDATE
                    oSay4:SetFont( oFontB )
       REDEFINE SAY oSay5 PROMPT "Labor" ID 171 OF oWorkB UPDATE
                    oSay5:SetFont( oFontB )
       REDEFINE SAY oSay6 PROMPT "Misc"  ID 174 OF oWorkB UPDATE
                    oSay6:SetFont( oFontB )
       REDEFINE SAY oSay7 PROMPT "SubTot" ID 137 OF oWorkB UPDATE
                    oSay7:SetFont( oFontB )
       REDEFINE SAY oSay8 PROMPT "Other" ID 134 OF oWorkB UPDATE
                    oSay8:SetFont( oFontB )
       REDEFINE SAY oSay9 PROMPT "Tax"   ID 176 OF oWorkB UPDATE
                    oSay9:SetFont( oFontB )
       REDEFINE SAY oSay10 PROMPT "Total" ID 179 OF oWorkB UPDATE
                    oSay10:SetFont( oFontB )


       // all gets

       REDEFINE COMBOBOX oTech  var cTech    ID 127 of oWorkB  ;
                ITEMS aTech UPDATE
                oTech:lIncSearch = .T.
       REDEFINE COMBOBOX oLoc   var cLoc     ID 131 of oWorkB  ;
                ITEMS aLoc UPDATE

       REDEFINE DTPICKER oDc VAR dDc         ID 128 OF oWorkB PICTURE '@D' UPDATE

       REDEFINE CHECKBOX oTaxable var lTaxable ID 167 of oWorkB ;
                ON CLICK ( _ReCalcTotals( oRsInvDetail,oRsInv,@lTaxable,oTaxable,"CLICKED",oLbxB,;
                           oLabor,oParts,oMisc,oTax,oTotal,cTaxSet,oOther,oSubtotal) )


       REDEFINE GET oParts     var xParts    ID 170 of oWorkB PICTURE "99,999,999.99" READONLY
       REDEFINE GET oLabor     var xLabor    ID 173 of oWorkB PICTURE "99,999,999.99" READONLY
       REDEFINE GET oMisc      var xMisc     ID 175 of oWorkB PICTURE "99,999,999.99" READONLY
       REDEFINE GET oSubtotal  var xSubtotal ID 138 of oWorkB PICTURE "99,999,999.99" READONLY
       REDEFINE GET oOther     var xOther    ID 135 of oWorkB PICTURE "99,999,999.99" READONLY


       REDEFINE GET oTax   var xTax   ID 177 of oWorkB PICTURE "99,999,999.99" READONLY

       REDEFINE GET oTotal var xTotal ID 183 of oWorkB PICTURE "99,999,999.99" READONLY

       REDEFINE SAY oSay11 ID 185 OF oWorkB UPDATE  // ----------------
       oSay11:SetFont( oFontB )

       // tax set

      REDEFINE COMBOBOX oTaxSet var cTaxSet    ID 187 of oWorkB  ;
                ITEMS aTax ;
                ON CHANGE _TaxSetUpdt( cTaxSet,oRsInvDetail,oRsInv,@lTaxable,oTaxable,oLbxB,;
                           oLabor,oParts,oMisc,oTax,oTotal,cTaxSet,oOther,oSubtotal ) UPDATE

       REDEFINE BTNBMP oBtn1 ID 147 PROMPT "Lookup"+CRLF+"Parts"  ;
                RESOURCE "SEARCH","DSEARCH","DSEARCH" TOP ;
                of oWorkB 2007 ;
                ACTION ( _InvtFind( oWnd,"",oWndChildB,@aLoc,oRsInvDetail,;
                                    oRsInv,@lTaxable,oTaxable,oLbxB,oFontB,oFontBig,nRepairNumber,;
                                    oLabor,oParts,oMisc,oTax,oTotal,nAssignedTo,cLoc,cTaxSet,;
                                    oOther,oSubtotal,lIsTrucker))

       REDEFINE BTNBMP oBtn2 ID 158 PROMPT "Next" ;
                RESOURCE "NEXT32" ;
                of oWorkB 2007 ;
                ACTION(_Invview( oWnd,oWndChildA,oWndChildB,oRsInv,;
                         oRsInvDetail,nRepairNumber,oLbxB,lTaxable,;
                         oTaxable,oFontB,cTaxSet,cLoc,dDc,cTech,aEmp,hDatas,cTaxDesc,xTitle,oTech))

       REDEFINE BTNBMP oBtn3 ID 178 PROMPT "Cancel" ;
                RESOURCE "EXIT" ;
                of oWorkB 2007 ;
                ACTION( hVar["lClosed"] := .f., oWndChildB:End() )

       REDEFINE BTNBMP oBtn4 ID 145 PROMPT "Add"+CRLF+"Item" ;
                RESOURCE "PLUS","DPLUS","DPLUS" TOP ;
                of oWorkB 2007 ;
                ACTION ( _AddNewRow( oRsInvDetail,nRepairNumber,nAssignedTo,cLoc,oLbxB,"N","" ) )

       REDEFINE BTNBMP oBtn6 ID 140 PROMPT "Return"+CRLF+"Item" ;
                RESOURCE "RETURN","DRETURN","DRETURN" TOP ;
                of oWorkB 2007 ;
                ACTION ( _AddNewRow( oRsInvDetail,nRepairNumber,nAssignedTo,cLoc,oLbxB,"N","RETURN" ) )



       REDEFINE BTNBMP oBtn5 ID 186 PROMPT "Cancel"+CRLF+"Unsaved Line" ;
                RESOURCE "MINUS32","DMINUS32","DMINUS32" TOP ;
                of oWorkB 2007 ;
                ACTION( _Manual( 46,oRsInvDetail,oRsInv,cLoc,oLbxB,nRepairNumber,nAssignedTo,;
                     oLabor,oParts,oMisc,oTax,oTotal,lTaxable,oTaxable,cTaxSet,oOther,oSubtotal))

     ACTIVATE DIALOG oWorkB NOMODAL ;
                ON INIT _ReCalcTotals(oRsInvDetail,oRsInv,@lTaxable,oTaxable,,oLbxB,;
                         oLabor,oParts,oMisc,oTax,oTotal,cTaxSet,oOther,oSubtotal ) ;
                VALID(!GETKEYSTATE( 27 ))

ACTIVATE WINDOW oWndChildB ;
   ON INIT ( oWorkB:Move( 0,0, oWndchildB:nWidth, oWndchildB:nHeight, .T. ), oLbxB:SetFocus(), ;
           oWndChildB:bResized := {|| _ReSizeUm( oWorkB,oWndChildB,oLbxB) }, ;
           oWorkB:refresh(.t.));
   VALID ( IIF( !lOK, ExitPgm(.T.,oWndChildB,oRsInvDetail,oRsEmp,oWndChildA,oLbxb,@lOk,;
                                  oRsInv,cLoc,hDatas ), .F. ))

RETURN( NIL )

//--------------------------------
Static FUNCTION ExitPgm( lOk3,oWndchildB,oRsInvDetail,oRsEmp,;
                         oWndChildA,oLbx,lOk,oRsInv,cLoc,hDatas )

// olbx is from the repair screen

LOCAL lOK1
local hVar := hDatas["var"]


*Msginfo( "Close tables emp,detail,inv Exitpgm after cancelum Quickview.prg ")

IF lOk3 = .T.
   lOK  := .T.
   lOK1 := lOK

   If hVar["lClosed"]  = .t.
   Else
      If _CancelUm( oRsInvDetail,oRsInv,oLbx,oWndChildB,cLoc,oWndChildA )
      Else
         lOk3 := .f.
         Return(.f.)
      Endif
   Endif

   oRsEmp:CLose()

   If oRsInvDetail:State() = 1 // open
      oRsInvDetail:Close()
   Endif

   If oRsInv:State() = 1 // open
      oRsInv:CLose()
   Endif

   oLbx:bKeyCount := { || 0 }
   oLbx:bKeyNo := { || 0 }

   oWndChildB:End()
   oWndChildA:End()

ENDIF

RETURN( lOK1 )
 


Image
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: To Mr. Rao

Postby Armando » Sun Jan 08, 2017 12:53 am

Rick:

Rick, you are always willing to help, as usualy

Thanks a lot.

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: To Mr. Rao

Postby Armando » Tue Jan 10, 2017 4:33 pm

Rick & Friends:

I am running a first program without problems, thanks to your first example.

I'm looking for something similar to the Manuel Mercado's TSBRowse class, you know it?

Now I'm going to try your second example.

Thanks a lot
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: To Mr. Rao

Postby Armando » Wed Jan 11, 2017 12:09 am

Rick:

May I see your source code for the follow functions?

// add a new record
oLbxB:bPastEof = {|| _AddNewRow( oRsInvDetail,nRepairNumber,nAssignedTo,cLoc,oLbxB,"N","" ) }

and

oWndChild:bResized := {|| _ReSizeUm( oDlg,oWndChild,oLbx) },


Thanks a lot for your appreciated help

Best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: To Mr. Rao

Postby Rick Lipkin » Wed Jan 11, 2017 7:17 pm

Armando

Here are your functions .. if you need anything else .. let me know

Rick Lipkin
Code: Select all  Expand view  RUN

//----------------
Static Func _AddNewRow( oRsInvDetail,nRN,nTech,cLocation,oBrw,cAsk,cReturn )

Local Saying,nEid,nKey

If empty( cAsk )
   cAsk := "Y"
Endif

If empty(cReturn)
   cReturn := "ADD"
Endif

If cAsk = "Y"

   Saying := "Do you wish to Add a New Record ?"
   If MsgYesNo( Saying )
   Else
      oBrw:SetFocus()
      Return(.f.)
   Endif

Endif

nKey := _GenKey(oRsInvDetail)
If nKey = -1
   MsgInfo( "Error creating Invoice Detail KEY" )
   Return(.f.)
Endif
* msginfo( "end Key" )

oRsInvDetail:AddNew()
*oRsInvDetail:Fields("InvDetailEid"):Value      := nEid
oRsInvDetail:Fields("Key"):Value               := nKey

oRsInvDetail:Fields("Repair Number"):Value     := nRn
oRsInvDetail:Fields("Item Description"):Value  := space(100)

If cReturn = "RETURN"
   oRsInvDetail:Fields("Qty"):Value               := -1
Else
   oRsInvDetail:Fields("Qty"):Value               := 1
Endif

oRsInvDetail:Fields("Price"):Value             := 0
oRsInvDetail:Fields("Tech Number"):Value       := nTech
oRsInvDetail:Fields("Inventory Id"):Value      := space(50)
oRsInvDetail:Fields("Inventory Type"):Value    := "Labor"
oRsInvDetail:Fields("Cost"):Value              := 0
oRsInvDetail:Fields("Covered By Warranty"):Value := .f.
oRsInvDetail:Fields("Extension"):Value         := 0
oRsInvDetail:Fields("Location"):Value          := cLocation
oRsInvDetail:Fields("Code"):Value              := space(25)
oRsInvDetail:Fields("NoTax"):Value             := 0
oRsInvDetail:Fields("IsSerial"):Value          := .f.
oRsInvDetail:Fields("IsLabor"):Value           := .f.
oRsInvDetail:Fields("Scrapped"):Value          := .f.

oRsInvDetail:Update()

oBrw:ReFresh()
oBrw:nColSel(3) // move to part number on add
oBrw:SetFocus()

Return(.t.)
//-------------------
Static Func _GenKey(oRsInvDetail)

LOCAL nRAND
LOCAL oRs, cSQL, oERR

If oRsInvDetail:Eof
   nRand := 100
Else
   nRand := oRsInvDetail:Fields("Key"):Value+1
Endif

Return(nRand)

//------------------------------
Static Func _ReSizeUm( oWorkB1,oWndChildB1,oLbxB1 )

oWorkB1:SetSize( oWndChildB1:nWidth, oWndChildB1:nHeight, .t. ) // frame and dialog link

// dialog controls
oWorkB1:bResized = { | nSizeType, nWidth, nHeight | ResizeControls( nSizeType, nWidth, nHeight, oWorkB1 )  }

oLbxB1:SetFocus()

Return(nil)

//-------------------------
Static Func ResizeControls( nSizeType, nWidth, nHeight, oWorkB1 )


if nSizeType = 0 //SIZE_MAXIMIZED

   oWorkB1:aControls[ 1 ]:SetSize( nWidth - 170, nHeight - 295 ) //txbrowse

endif

Return(nil)

 
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: To Mr. Rao

Postby Armando » Wed Jan 11, 2017 7:29 pm

Rick:

Thanks a lot.

Best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 15 guests