Right click in DCBrowse
Right click in DCBrowse
Hi,
I have a handler to process a right click in a browse. This is working without a problem.
However I would like to select the line in the browse and process with one click. At this time I have to select the line in the browse with the left button, and then I can click the right button.
The action of my right click is always on the selected line. The user has to click twice, left to select, right to fire the action. I would like to do this with one right click.
With RBSELECT my RIGHT click is fired, and after my action, the line is selected. This is logical, because my handler is evaluated before the standard handler.
I have a handler to process a right click in a browse. This is working without a problem.
However I would like to select the line in the browse and process with one click. At this time I have to select the line in the browse with the left button, and then I can click the right button.
The action of my right click is always on the selected line. The user has to click twice, left to select, right to fire the action. I would like to do this with one right click.
With RBSELECT my RIGHT click is fired, and after my action, the line is selected. This is logical, because my handler is evaluated before the standard handler.
Re: Right click in DCBrowse
I use the combination of RBSELECT and RBDOWN in lots of applications with no problem.
Look at the sample in \exp19\samples\browse\autorest.prg.
Look at the sample in \exp19\samples\browse\autorest.prg.
The eXpress train is coming - and it has more cars.
Re: Right click in DCBrowse
Hi Roger,
It isn't working as expected. I tried the RBDOWN as follows in the autorest.prg.
The msgbox is shown at startup, but isn't working when right-clicking?
I didn't find the RBDOWN in the documentation.
It isn't working as expected. I tried the RBDOWN as follows in the autorest.prg.
Code: Select all
@ 1,0 DCBROWSE oBrowse DATA aDir PRESENTATION DC_BrowPres() ;
SIZE 400,200 PIXEL FIT ;
ID 'DIRECTORY_BROWSE' ;
HEADLINES 3 ;
RBSELECT ;
RBDOWN msgbox("test") // BrowseMenuBlock(@oBrowse)
I didn't find the RBDOWN in the documentation.
Re: Right click in DCBrowse
Roger,
I did another test with autorest.prg. I modified the function BrowseMenuBlock. I just added a WTF.
The wtf is executed at startup, and not at a right-click.
I did another test with autorest.prg. I modified the function BrowseMenuBlock. I just added a WTF.
Code: Select all
STATIC FUNCTION BrowseMenuBlock( oBrowse )
wtf "test"
RETURN {|x,y,z,o|o := BrowseMenu( oBrowse ), ;
o:popup( nil, x, 1 , ;
XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN ) }
Re: Right click in DCBrowse
Chris -
You need to put it in a codeblock.
RBDOWN {||Msgbox('test')}
You need to put it in a codeblock.
RBDOWN {||Msgbox('test')}
The eXpress train is coming - and it has more cars.
Re: Right click in DCBrowse
Roger,
I will try it, but why is autorest.prg working?
As you can see, there is no codeblock.
Addition:
Now I see it. The function BrowseMenuBlock(@oBrowse) is executed when the browse is created. This function returns the required codeblock. This codeblock is executed each time the RBDOWN is fired.
I will try it, but why is autorest.prg working?
Code: Select all
@ 1,0 DCBROWSE oBrowse DATA aDir PRESENTATION DC_BrowPres() ;
SIZE 400,200 PIXEL FIT ;
ID 'DIRECTORY_BROWSE' ;
HEADLINES 3 ;
RBSELECT ;
RBDOWN BrowseMenuBlock(@oBrowse)
Addition:
Now I see it. The function BrowseMenuBlock(@oBrowse) is executed when the browse is created. This function returns the required codeblock. This codeblock is executed each time the RBDOWN is fired.
Last edited by skiman on Thu Mar 03, 2011 12:40 am, edited 1 time in total.
Re: Right click in DCBrowse
Yes, that's it.
With a codeblock it's working.

With a codeblock it's working.
Re: Right click in DCBrowse
Roger,
It seems as the RBDOWN is executed before the RBSELECT. I'm browsing a database and the RBDOWn codeblock returns the value of the previous selected record.
Could you clarify the RBDOWN {| a,b,c,d | .... } ?
What is passed to the codeblock?
It seems as the RBDOWN is executed before the RBSELECT. I'm browsing a database and the RBDOWn codeblock returns the value of the previous selected record.
Could you clarify the RBDOWN {| a,b,c,d | .... } ?
What is passed to the codeblock?
Re: Right click in DCBrowse
Hi, Chris.
And you will find out:
a is the absolute position clicked.
b is nil.
c is a reference to the XbpCellGroup-Object (DataArea).
d is nil.
You can do things like this by yourself:Could you clarify the RBDOWN {| a,b,c,d | .... }
Code: Select all
RBDOWN {| a,b,c,d | DC_DebugQout(a),DC_DebugQout(b),DC_DebugQout(c),DC_DebugQout(d) }
a is the absolute position clicked.
b is nil.
c is a reference to the XbpCellGroup-Object (DataArea).
d is nil.
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: Right click in DCBrowse
Hi Roger,
With the following changes in autorest you can see that the RBDOWN block is executed before the RBSELECT.
The original autorest seemed to work, because the menu is positioned at the position of the cursor. However, the row in the browse isn't selected at the moment the menu appear.
With the above modification you can see that the codeblock is executed, and after this the RBSELECT is activated.
Maybe I can check this in my own handler by looking for the rbUP? Have to test this.
With the following changes in autorest you can see that the RBDOWN block is executed before the RBSELECT.
Code: Select all
...
@ 1,0 DCBROWSE oBrowse DATA aDir PRESENTATION DC_BrowPres() ;
SIZE 400,200 PIXEL FIT ;
ID 'DIRECTORY_BROWSE' ;
HEADLINES 3 ;
RBSELECT ;
RBDOWN {|| BrowseMenuBlock(@oBrowse) }
...
STATIC FUNCTION BrowseMenuBlock( oBrowse )
wtf 'rbdown'
sleep(500)
RETURN .T.
With the above modification you can see that the codeblock is executed, and after this the RBSELECT is activated.
Maybe I can check this in my own handler by looking for the rbUP? Have to test this.