xBrowse

xBrowse

Postby Bayron » Wed Sep 14, 2011 5:06 am

Hi all,

Using a DBF with no index...

Which is the rigth way to programatically delete the current record from a Browse???

oBrw:Delete() does not seem to doit for me...
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: xBrowse

Postby Otto » Wed Sep 14, 2011 7:57 am

Do you have SET DELETED ON in your code?

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse

Postby nageswaragunupudi » Wed Sep 14, 2011 11:59 am

Code: Select all  Expand view
( oBrw:cAlias )->( DbDelete() )
oBrw:Refresh()
Regards

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

Re: xBrowse

Postby Bayron » Wed Sep 14, 2011 4:02 pm

Otto wrote:Do you have SET DELETED ON in your code?


Thanks Otto, Yes It's ON

Code: Select all  Expand view
( oBrw:cAlias )->( DbDelete() )
oBrw:Refresh()


Thanks Mr. Rao, It worked as I needed after a few changes in my other code...

Amazingly I did not find It's correct use, on a quick lookup... But I knew that you had the right solution, next time I am going to start by reading your post's...
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: xBrowse

Postby Bayron » Wed Sep 14, 2011 5:42 pm

After deleting a random row, I get this visual problem now:
Image
I achieve the effect using :bClrStd

Is there a way to refresh the colors of the browse???

.OR.

I tried to avoid this not turning SET DELETED ON, but the row does not appears DISABLED as it should be, and the button in that deleted row still works, and the text is still shown as Non Deleted.

Is there a way to show it disabled????
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: xBrowse

Postby Antonio Linares » Wed Sep 14, 2011 6:25 pm

Bayron,

I achieve the effect using :bClrStd


Please post the code you use for bClrStd, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: xBrowse

Postby Bayron » Wed Sep 14, 2011 6:28 pm

Code: Select all  Expand view
:bClrStd  := { || If( Eval( ListVen:bKeyNo,,ListVen ) % 2 == 0, { CLR_BLACK, RGB( 224, 236, 255 ) }, { CLR_BLACK, RGB( 189, 211, 253 ) } ) }
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: xBrowse

Postby nageswaragunupudi » Wed Sep 14, 2011 8:05 pm

oBrw:KeyNo() returns the OrdKeyNo() as returned by the RDD. Less known is the fact that OrdKeyNo() returns correct serial number only when FILTER is set on ".NOT. DELETED()" when SET DELETED is ON.

So,
USE <dbf>
SET DELETED ON !DELETED()
GO TOP

Then browse as usual.
Regards

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

Re: xBrowse

Postby Bayron » Wed Sep 14, 2011 9:23 pm

Code: Select all  Expand view
SET DELETED ON !DELETED()

Does not work on FWH10.2 and xHarbour 1.21...
I also tried:
Code: Select all  Expand view
SET DELETED ON
SET FILTER TO !DELETED()


Anyhow, xBrowse is behaven normally...
The problem is that each line is painted before a row is deleted... and when oBrw:Refresh() is called, :bClrStd is not Evaluated and Repainted again...

So if there is not an easy solution ?????? I think I am just going to have to paint a single color in the browse...

Which leads to my next question:

Is there a way to paint the Browse Client Area when the Database is Empty??? Right now is ALL WHITE...
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: xBrowse

Postby Antonio Linares » Wed Sep 14, 2011 11:09 pm

Bayron,

Use that FOR ... condition to create the index:

INDEX ON ... FOR ! Deleted() ...

example:
Code: Select all  Expand view
     INDEX ON Name TAG "Name" ;
         TO ( cPath + "\Test" ) FOR ! Test->( Deleted() )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: xBrowse

Postby Bayron » Thu Sep 15, 2011 2:29 am

Thanks for taking the time to answer my post, but the problem is not about the Deleted Records, but is that when I delete a record, the color of that row is lost and I get two consecutive rows with the same color....As you can see the above picture...
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: xBrowse

Postby nageswaragunupudi » Thu Sep 15, 2011 3:57 am

Here is a working sample:
Please adopt this logic to your case.
Code: Select all  Expand view
#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"

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

REQUEST DBFCDX

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

function Main()

   local oDlg, oBrw, oFont

   SET DELETED ON

   USE CUSTOMER
   SET FILTER TO !DELETED()
   GO TOP

   DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-12
   DEFINE DIALOG oDlg SIZE 600,400 PIXEL FONT oFont

   @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      COLUMNS "First", "City", "State", "Salary" ;
      ALIAS 'CUSTOMER' CELL LINES NOBORDER

   WITH OBJECT oBrw
      :bClrStd    := { || { CLR_BLACK, If( oBrw:KeyNo() % 2 == 0, RGB(224,236,255), RGB(189,211,253) ) } }
      :bKeyDown   := { |nKey| If( nKey == VK_DELETE, (oBrw:cAlias)->( BrwDelete( oBrw ) ), nil ) }
   END


   oBrw:CreateFromCode()
   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont


return (0)

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

static function BrwDelete( oBrw )

   if DbrLock()
      DELETE
      DbUnlock()
      SKIP
      if ( eof() )
         GO BOTTOM
      endif
      oBrw:Refresh()
   endif

return nil

//----------------------------------------------------------------------------//
 
Regards

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

Re: xBrowse

Postby nageswaragunupudi » Thu Sep 15, 2011 3:58 am

FiveWin, One line of code and it's done...


Well Said !!!!
Regards

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

Re: xBrowse

Postby nageswaragunupudi » Thu Sep 15, 2011 4:26 am

Is there a way to paint the Browse Client Area when the Database is Empty??? Right now is ALL WHITE...

As of now, no.
You may try having one blank record to get the effect you want.
Regards

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

Re: xBrowse

Postby Bayron » Thu Sep 15, 2011 4:29 am

Thanks for your answer, I do use basicly the same logic, but as I said before
The problem is not about the Deleted Records, but is that when I delete a record, the color of that row is lost and I get two consecutive rows with the same color....As you can see the above picture...


I think the problem is with the painting, when I use oBrw:Refresh() :bClrStd is not Evaluated and Repainted again...

I am just going to set the browse records on a single color... to avoid all of the trouble...
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 60 guests