a few questions about browse

a few questions about browse

Postby plantenkennis » Tue Dec 20, 2016 9:37 pm

Hello Antonio,
I have two question about browse:

1.
Is it possible to get the column number where I click in. I want to have a browse for an array, where in the first column there is a value and in the second column i have a bmp to delete that row.
Code: Select all  Expand view

AADD(aName, { 'first name', 'delete.bmp'})
AADD(aName, { 'second name', 'delete.bmp'})
AADD(aName, { 'third name', 'delete.bmp'})
AADD(aName, { 'fourth name', 'delete.bmp'})

        @ 270, 120 LISTBOX oBrwNed FIELDS "", "" ;
            HEADERS "Value", "Delete" ;
            OF oFld:aDialogs[ 1 ] SIZE 450, 150
            oBrwNed:SetArray( aName )
            oBrwNed:bLine = { | nRow | IF( nRow <= Len( aName ), aName[ nRow ], { "", "" } ) }
            oBrwNed:SetColWidth( 1, 400 )
            oBrwNed:SetColWidth( 2, 30 )
            oBrwNed:SetColBmp( 2 )
            oBrwNed:SetColEditable( 1, .F. )
            oBrwNed:SetColEditable( 2, .F. )
            oBrwNed:SetColor( OwnClrGreen, OwnClrYellow )
            oBrwNed:Select( 1 )
            oBrwNed:bChange := { | obj , nindex| Msginfo( obj:nRowPos() )}
            oBrwNed:bAction := { | obj , nindex|  RK_Wijzig(oBrwNed:nArrayAt, 'Name', aName) }
 

If I click on a row I can change the name, but if I click on the Delete button on column 2 I want to delete it. Is this possible?

2.
When I click in the same browse on an empty row I still get value 1 as nRowPos. Should this not be 0 (zero) or NILL
Kind regards,

René Koot
User avatar
plantenkennis
 
Posts: 166
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands

Re: a few questions about browse

Postby Antonio Linares » Wed Dec 21, 2016 7:23 am

regards, saludos

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

Re: a few questions about browse

Postby Antonio Linares » Wed Dec 21, 2016 7:25 am

regards, saludos

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

Re: a few questions about browse

Postby Antonio Linares » Wed Dec 21, 2016 8:33 am

René,

Already implemented, I am emailing you the modified libs.

Here it is an example of use:

oBrw:bAction = { | oBrw | MsgInfo( oBrw:nColPos() ) }

I am going to review the nRowPos issue
regards, saludos

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

Re: a few questions about browse

Postby Antonio Linares » Wed Dec 21, 2016 8:45 am

> I am going to review the nRowPos issue

Fixed. I am sending you new modified libs.

Now nRowPos() should return zero when clicking on an empty row

I have not tested it. I appreciate your feedback
regards, saludos

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

Re: a few questions about browse

Postby plantenkennis » Wed Dec 21, 2016 7:16 pm

Hello Antonio,

Wow, every time I am surprised by the speed you addept the libs. Both functions are working great. I am very happy with this.
Kind regards,

René Koot
User avatar
plantenkennis
 
Posts: 166
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands

Re: a few questions about browse

Postby Antonio Linares » Wed Dec 21, 2016 7:21 pm

very good :-)
regards, saludos

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

Re: a few questions about browse

Postby plantenkennis » Fri Dec 30, 2016 5:29 pm

Hello Antonio,

I need a little more help with my browse. I have a browse with an array. In column one I have a name, in column two I have a bitmap to delete that name. With the oBrw:oChange I can get the column where there is clicked, but only if the row is also changed. If the row is selected and I click on the delete bitmap, nothing happens. Here is my code.
Code: Select all  Expand view

#include "FiveMac.ch"

function Main()

   local oWnd, oBrw
   local cpath:=Path()
   local aNames[0][2]
   
    AADD(aNames, {'name 1', 'Delete.png'})
    AADD(aNames, {'name 2', 'Delete.png'})
    AADD(aNames, {'name 3', 'Delete.png'})
    AADD(aNames, {'name 4', 'Delete.png'})
    AADD(aNames, {'name 5', 'Delete.png'})

   DEFINE WINDOW oWnd TITLE "DBF Browse" ;
      FROM 213, 109 TO 650, 820

  @ 48, 20 LISTBOX oBrw FIELDS "", "" ;
            HEADERS "name", "Del" ;
            OF oWnd SIZE 450, 150
            oBrw:SetArray( aNames )
            oBrw:bLine = { | nRow | IF( nRow <= Len( aNames ), aNames[ nRow ], { "", "" } ) }
            oBrw:SetColWidth( 1, 300 )
            oBrw:SetColWidth( 2, 50 )
            oBrw:SetColEditable( 1, .F. )
            oBrw:SetColEditable( 2, .F. )
            oBrw:SetColBmp( 2 )
            oBrw:Select( 1 )
            oBrw:bChange := { | oBrw | Msginfo('column: ' + STR(oBrw:nColPos()) )}
            oBrw:bAction := { | obj , nindex | MsgInfo( obj:nRowPos() ) }
   

   ACTIVATE WINDOW oWnd

return nil
 


This is what I want:
If the user doubleclicks on an item in the first column, he can change this item
If the user clicks on the delete-button in the second column, the user gets the question if he wants to delete that row.
Am I missing something, or is this not possible.
Kind regards,

René Koot
User avatar
plantenkennis
 
Posts: 166
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands

Re: a few questions about browse

Postby Antonio Linares » Fri Dec 30, 2016 6:08 pm

René,

Try this:

oBrw:bAction := { | obj | If( oBrw:nColPos() == 2, MsgInfo( "delete" ),) }

There is no need to use bChange
regards, saludos

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

Re: a few questions about browse

Postby plantenkennis » Fri Dec 30, 2016 7:13 pm

Hello Antonio,

But the bAction only reacts on a doubleclick, and I want the delete action just when I click on it.
Kind regards,

René Koot
User avatar
plantenkennis
 
Posts: 166
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands

Re: a few questions about browse

Postby Antonio Linares » Fri Dec 30, 2016 8:18 pm

René,

I have modified FiveMac libs and already sent them to you

This is the way to do it:

oBrw:bMouseDown = { | nRow, nCol, oControl | MsgInfo( Str( nCol ) ) }

Please try it and let me know if it is ok for you, thanks
regards, saludos

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

Re: a few questions about browse

Postby plantenkennis » Sat Dec 31, 2016 9:48 am

Hello Antonio,

Again, thank you very much. This is excactly what I mean.

HAPPY NEWYEAR :D
Kind regards,

René Koot
User avatar
plantenkennis
 
Posts: 166
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands

Re: a few questions about browse

Postby Antonio Linares » Sat Dec 31, 2016 9:56 am

Happy new year :-)
regards, saludos

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


Return to FiveMac / FivePhone (iPhone, iPad)

Who is online

Users browsing this forum: No registered users and 3 guests

cron