Right click in DCBrowse
Re: Right click in DCBrowse
Hi, Chris.
RBDOWN must be the event firing first, since this is the "real" event (right button of the mouse down), while "RBSELECT" follows this: The right mouse button was clicked into a cellgroup, the cell can be selected, so it creates this event afterwards. The first thing is the "what" (mouse event), the second is the "where" (cellgroup was clicked).
RBDOWN must be the event firing first, since this is the "real" event (right button of the mouse down), while "RBSELECT" follows this: The right mouse button was clicked into a cellgroup, the cell can be selected, so it creates this event afterwards. The first thing is the "what" (mouse event), the second is the "where" (cellgroup was clicked).
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 Tom,
Maybe, but I want it different.
This is my situation. I have a browse of products in an invoice. i want to insert a product between two lines. Now I have to select the line where I want to insert, and the I can use the RBDOWN to call my block and insert the product.
I want to insert immediately with one click. My problem is now that with the RBDOWN the record where I clicked isn't selected.
Maybe, but I want it different.

This is my situation. I have a browse of products in an invoice. i want to insert a product between two lines. Now I have to select the line where I want to insert, and the I can use the RBDOWN to call my block and insert the product.
I want to insert immediately with one click. My problem is now that with the RBDOWN the record where I clicked isn't selected.
Re: Right click in DCBrowse
Hi,
I tested with my own handler. This is the order everything is processed.
- Right Down in the handler.
- RBDOWN code block.
- Right UP in the handler.
- RBSELECT
I found a solution to solve it, so there is no need to modify eXPress++ for me. However, I'm wondering if the above order is logical?
I tested with my own handler. This is the order everything is processed.
- Right Down in the handler.
- RBDOWN code block.
- Right UP in the handler.
- RBSELECT
I found a solution to solve it, so there is no need to modify eXPress++ for me. However, I'm wondering if the above order is logical?
Re: Right click in DCBrowse
Chris -
That seems wrong to me, because I use RBSELECT and RBDOWN in lots of applications to pop up a menu in the browse. Bobby Drakos' Taxi software also uses this extensively through the app. I just ran his app to be sure about this and I can see that the record is selected when the menu pops up.
Try putting this in your RBDOWN codeblock:
DCBROWSE .. RBSELECT RBDOWN {||DC_CompleteEvents(), DoSomething()}
Roger
That seems wrong to me, because I use RBSELECT and RBDOWN in lots of applications to pop up a menu in the browse. Bobby Drakos' Taxi software also uses this extensively through the app. I just ran his app to be sure about this and I can see that the record is selected when the menu pops up.
Try putting this in your RBDOWN codeblock:
DCBROWSE .. RBSELECT RBDOWN {||DC_CompleteEvents(), DoSomething()}
Roger
The eXpress train is coming - and it has more cars.
Re: Right click in DCBrowse
Hi Roger,
The menu popup appears at the right position. RBDOWN is passing this position. However the line is not selected at the moment the menu pops up.
The menu popup appears at the right position. RBDOWN is passing this position. However the line is not selected at the moment the menu pops up.
Re: Right click in DCBrowse
Can you please give me some source code showing the problem.
I cannot reproduce it.
I cannot reproduce it.
The eXpress train is coming - and it has more cars.
Re: Right click in DCBrowse
Roger,
In attachment a modified autorest.prg.
You will see the different actions.
In attachment a modified autorest.prg.
You will see the different actions.
- Attachments
-
- autorest.zip
- (1.32 KiB) Downloaded 936 times
Re: Right click in DCBrowse
Hi Chris
This is what I use. You will see that I put it in the EVAL clause - I don't use the RBDOWN clause. This code will set focus to the row that you right click on and show the context menu. I am sure that there is someone else that would be able to give a more elegant resolution, but this works for me.
EVAL {|o| o:itemMarked := {|| ;
IIF(lClear ,Eval(bResetSch) ,Nil) ,;
IIF(lClear, DC_GetRefresh(GetList,Nil,DCGETREFRESH_ID_INCLUDE ,;
{'1'}) ,Nil) ,;
IIF(lSearched ,Eval(bSetScope) ,Nil) ,;
lClear := .f. ,lSearched := .f. ,SetAppFocus(oSch) } ,;
o:ItemRbDown := { |mp1,mp2,oXbp| oxbp:dehilite() ,;
(oxbp:datasource)->(Dbskip(mp2[1]-oxbp:rowpos)) ,;
oxbp:rowpos:=mp2[1] ,;
oxbp:refreshall() ,;
eval(bSetscope) ,;
oMenuBrow:PopUp (oXbp,mp1, 1 ,;
XBPMENU_PU_DEFAULT ) } }
regards
frans
This is what I use. You will see that I put it in the EVAL clause - I don't use the RBDOWN clause. This code will set focus to the row that you right click on and show the context menu. I am sure that there is someone else that would be able to give a more elegant resolution, but this works for me.
EVAL {|o| o:itemMarked := {|| ;
IIF(lClear ,Eval(bResetSch) ,Nil) ,;
IIF(lClear, DC_GetRefresh(GetList,Nil,DCGETREFRESH_ID_INCLUDE ,;
{'1'}) ,Nil) ,;
IIF(lSearched ,Eval(bSetScope) ,Nil) ,;
lClear := .f. ,lSearched := .f. ,SetAppFocus(oSch) } ,;
o:ItemRbDown := { |mp1,mp2,oXbp| oxbp:dehilite() ,;
(oxbp:datasource)->(Dbskip(mp2[1]-oxbp:rowpos)) ,;
oxbp:rowpos:=mp2[1] ,;
oxbp:refreshall() ,;
eval(bSetscope) ,;
oMenuBrow:PopUp (oXbp,mp1, 1 ,;
XBPMENU_PU_DEFAULT ) } }
regards
frans
Re: Right click in DCBrowse
Hi Frans,
I found a solution for it, but I don't think it is correct behaviour.
I did it as follows:
This way the itemmarked is excuting the function I want with the Rclick. At the moment the itemmarked is excuted, the line is already selected.
One problem to solve with the above method: Right clicking on a line which is already selected. I did this in the handler to check for the RBdown event.
I found a solution for it, but I don't think it is correct behaviour.
I did it as follows:
Code: Select all
RBDOWN {|| lRight := .T. }
ITEMMARKED {|| iif(lRight, startfunction(),),lRight:= .F., .... }
One problem to solve with the above method: Right clicking on a line which is already selected. I did this in the handler to check for the RBdown event.
Re: Right click in DCBrowse
This code works correctly.
The DC_CompleteEvents() insures that the rbdown event moves the browse pointer before the menu is dropped.
The DC_CompleteEvents() insures that the rbdown event moves the browse pointer before the menu is dropped.
Code: Select all
#INCLUDE "dcdialog.CH"
#include "appevent.ch"
FUNCTION Main()
LOCAL GetList[0], GetOptions, aDir, aHeadings, i, oBrowse , lRight := .F.
aDir := Directory()
aHeadings := { 'File;Name', ;
'File;Size', ;
'Date;Last;Write', ;
'Time;Last;Write', ;
'File;Attr', ;
'Size;Extend;Attr', ;
'Create;Date', ;
'Create;Time', ;
'Date;Last;Access', ;
'Time;Last;Access' }
@ 0,0 DCSAY 'Click Right Button in a Column for menu' ;
SAYSIZE 50 COLOR GRA_CLR_BLUE
@ 1,0 DCBROWSE oBrowse DATA aDir PRESENTATION DC_BrowPres() ;
ITEMMARKED {|| if(lRight,rightclicked(),'')} ;
SIZE 400,200 PIXEL FIT ;
ID 'DIRECTORY_BROWSE' ;
HEADLINES 3 ;
RBSELECT ;
RBDOWN browseMenuBlock(@oBrowse)
FOR i := 1 TO Len(aHeadings)
DCBROWSECOL ELEMENT i HEADER aHeadings[i] ;
WIDTH 60 PIXEL PARENT oBrowse
NEXT
DCGETOPTIONS ;
NOMINBUTTON ;
NOMAXBUTTON ;
AUTORESIZE ;
BUTTONALIGN DCGUI_BUTTONALIGN_CENTER
DCREAD GUI ;
FIT ;
BUTTONS DCGUI_BUTTON_OK ;
OPTIONS GetOptions ;
TITLE 'Directory Browse' ;
MODAL ;
SETAPPWINDOW
RETURN nil
* -------------
STATIC FUNCTION BrowseMenu( oBrowse )
STATIC soMenu, soBrowse
LOCAL GetList[0], i
IF Valtype(soMenu) # 'O' .OR. soMenu:status()<=0 .OR. soBrowse # oBrowse
IF Valtype(soMenu) = 'O'
soMenu := nil
ENDIF
soBrowse := oBrowse
DCSUBMENU soMenu
DCMENUITEM 'Move Column &Left' PARENT soMenu ACTION {||soBrowse:moveColumn(-1)}
DCMENUITEM 'Move Column &Right' PARENT soMenu ACTION {||soBrowse:moveColumn(1)}
DCMENUITEM SEPARATOR PARENT soMenu
DCMENUITEM 'Restore Defaults' PARENT soMenu ACTION {||soBrowse:restoreDefaults()}
DCREAD GUI ;
PARENT oBrowse ;
EXIT
ENDIF
RETURN soMenu
* --------------
STATIC FUNCTION BrowseMenuBlock( oBrowse )
RETURN {|x,y,z,o|DC_CompleteEvents(), ;
(wtf oBrowse:datasource[oBrowse:arrayElement,1]), ;
o := BrowseMenu( oBrowse ), ;
o:popup( nil, x, 1 , ;
XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN ) }
* -------------
PROC appsys ; RETURN
The eXpress train is coming - and it has more cars.