Right click in DCBrowse

This forum is for eXpress++ general support.
Message
Author
skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Right click in DCBrowse

#1 Post by skiman »

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.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Right click in DCBrowse

#2 Post by rdonnay »

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.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Right click in DCBrowse

#3 Post by skiman »

Hi Roger,

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)
The msgbox is shown at startup, but isn't working when right-clicking?

I didn't find the RBDOWN in the documentation.
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Right click in DCBrowse

#4 Post by skiman »

Roger,

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 ) }
The wtf is executed at startup, and not at a right-click.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Right click in DCBrowse

#5 Post by rdonnay »

Chris -

You need to put it in a codeblock.

RBDOWN {||Msgbox('test')}
The eXpress train is coming - and it has more cars.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Right click in DCBrowse

#6 Post by skiman »

Roger,

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)
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.
Last edited by skiman on Thu Mar 03, 2011 12:40 am, edited 1 time in total.
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Right click in DCBrowse

#7 Post by skiman »

Yes, that's it. :D

With a codeblock it's working.
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Right click in DCBrowse

#8 Post by skiman »

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?
Best regards,

Chris.
www.aboservice.be

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Right click in DCBrowse

#9 Post by Tom »

Hi, Chris.
Could you clarify the RBDOWN {| a,b,c,d | .... }
You can do things like this by yourself:

Code: Select all

RBDOWN {| a,b,c,d | DC_DebugQout(a),DC_DebugQout(b),DC_DebugQout(c),DC_DebugQout(d) }
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.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Right click in DCBrowse

#10 Post by skiman »

Hi Roger,

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.
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.
Best regards,

Chris.
www.aboservice.be

Post Reply