FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Disable mouse double click event on xBrowse ? (Solved)
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Wed Dec 17, 2008 08:38 AM

Hi,

How do I disable a mouse double click event on xBrowse ?

How do I trap a mouse double click event on xBrowse ?

oBrwMenu:bLClicked is used for left click, what could be the equivalent for Mouse left button double click

I want to ignore Mouse Double clicks on a particular column in xBrowse. Is that possible ?

Regards

Anser

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Wed Dec 17, 2008 08:59 AM

Hi

I got it oBrw:bLDblClick

But how do I ignore a Mouse double click on a particular Column in xBrowse ?

Any help ?

Regards

Anser

Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Wed Dec 17, 2008 07:06 PM
if oBrw:nColSel != x
   your code here
end


Where x = the col that you want do ignore
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 06:28 AM
Dear Sambomb,

Unfortunately the mouse double click is still activating the GET

code tried as per your suggestion

// Mouse Double Click event for the Whole column in this xBrowse
oBrwMenu:bLDblClick:= { |nRow,nCol| if(oBrwMenu:nColSel == 2,NIL,) }

// Mouse Double Click event for Column 2 of this xBrowse
oBrwMenu:aCols[2]:bLDClickData := { |nRow,nCol| if(oBrwMenu:nColSel == 2,NIL,) }


Regards

Anser
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 09:24 AM
Any help ? Double clcik is activating a GET which is not desired.

I had similiar problem (GET appearing) when using Enter Key at this column, but I solved that using the following code

oBrwMenu:bKeyDown= {|nKey| if(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][4], , ; // If submenu then do nothing, bwhen will take care
							   ( oBrwMenu:nColSel:=2 ,;  // else ie Menu items
							     if ( nKey  == VK_RETURN, PostMessage( oBrwMenu:hWnd, WM_KEYDOWN, 27 ), ) ;
							    ) ) }


unfortunately the same code is not working with Mouse Double Click event


Regards

Anser
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 10:33 AM
   DATA oVScroll,;   // Horizontal scrollbar (used internally)
        oHScroll,;   // Vertical scrollbar (used internally)
        [red]oCapCol,;    // Actual mouse captured column (used internally)[/red]
        oSeek,;      // Optional TSay control to display the value of current ::cSeek value
        oDbf         // Just a container for a DBF object for your own use (it is not used by the class)

   METHOD MouseColPos( nCol )

I'll test here and tell you more....
But try:
   oBrwMenu:aCols[2]:LDblClick := {|nRow, nCol| if(nCol == 2, nil, )}
And:
   oBrwMenu:aCols[2]:bLDClickData := { |nRow,nCol| if(oBrwMenu:oCapCol == 2,NIL,) }

Test change the NIL in the true result in the test for oBrwMenu:Refresh() maybe the nil don't change the structure of the xBrowse like you want.
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 11:09 AM
Dear sambomb

I tried again but no success ? Is there anyhing wrong with the bEditValue and bEditType


// No edit for SubMenu
oBrwMenu:aCols[2]:bEditWhen  := { || iif(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][4],.F.,.T.) } 
// Edit Type is set to GET, other options are List,Button Etc.
oBrwMenu:aCols[2]:nEditType  := EDIT_GET
oBrwMenu:aCols[2]:bEditvalue := { || space(0) }
*oBrwMenu:aCols[2]:bEditvalue := { || if(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][3],"Disable ?","Enable ?") }
oBrwMenu:aCols[2]:bOnPostEdit:= { | oCol, xValue, nLastKey | MenuAccessOnEdit( oCol, xValue, nLastKey,oMenuArray )


Regards

Anser
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 11:20 AM
anserkk wrote:Dear sambomb

I tried again but no success ? Is there anyhing wrong with the bEditValue and bEditType


// No edit for SubMenu
oBrwMenu:aCols[2]:bEditWhen  := { || iif(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][4],.F.,.T.) } 
// Edit Type is set to GET, other options are List,Button Etc.
oBrwMenu:aCols[2]:nEditType  := EDIT_GET
oBrwMenu:aCols[2]:bEditvalue := { || space(0) }
*oBrwMenu:aCols[2]:bEditvalue := { || if(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][3],"Disable ?","Enable ?") }
oBrwMenu:aCols[2]:bOnPostEdit:= { | oCol, xValue, nLastKey | MenuAccessOnEdit( oCol, xValue, nLastKey,oMenuArray )


Regards

Anser

oBrwMenu:aCols[2]:bEditWhen  := { || EditTest() }

Function EditTest()
Local Result := .F.
if  oBrwMenu:aArrayData[oBrwMenu:nArrayAt][4]
   Result := .F.
else
   Result := .T.
end

if oBrwMenu:oCapCol == 2
   Result := .F.
end

Return Result


Try this [;)]
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 11:37 AM
Dear Sambomb,

I am herewith pasting a sample code which you can test it yourself.

You can copy paste and run exe at your end.

You should Try Enter Key, Mouse Left Click and Mouse Left Button Double Click on the 2nd Column ie Status

Please note the problem when using Mouse Double Click

TestXbrw.Prg
#Include "FiveWin.ch"
#Include "xBrowse.ch"

*------------------------------------*
Function Main()
*------------------------------------*
Local oDlg,oBrwMenu,oBtnCancel
Local aMenu:={}, aClrCol:={}

aAdd(aMenu,{ 1,"Masters                       ",.F.,.T. })
aAdd(aMenu,{ 2,"     Account Groups           ",.F.,.F. })
aAdd(aMenu,{ 3,"     Account Heads            ",.F.,.F. })
aAdd(aMenu,{ 4,"     Exit                     ",.F.,.F. })
aAdd(aMenu,{ 5,"Transactions                  ",.F.,.T. })
aAdd(aMenu,{ 6,"     Voucher Entry            ",.F.,.F. })
aAdd(aMenu,{ 7,"     Sales Postings           ",.F.,.T. })
aAdd(aMenu,{ 8,"          From GDMS           ",.F.,.T. })
aAdd(aMenu,{ 9,"               Test sub menu 1",.F.,.F. })
aAdd(aMenu,{10,"          From PDMS           ",.F.,.F. })
aAdd(aMenu,{11,"     Test Menu                ",.F.,.F. })
aAdd(aMenu,{12,"Reports                       ",.F.,.T. })
aAdd(aMenu,{13,"     Trial Balance            ",.F.,.F. })
aAdd(aMenu,{14,"     Profit & Loss Statement  ",.F.,.F. })
aAdd(aMenu,{15,"     Balance Sheet            ",.F.,.F. })
aAdd(aMenu,{16,"     Statement of Account     ",.F.,.F. })
aAdd(aMenu,{17,"     Debtor                   ",.F.,.F. })
aAdd(aMenu,{18,"Tools                         ",.F.,.T. })
aAdd(aMenu,{19,"     Select Financial Year    ",.F.,.F. })
aAdd(aMenu,{20,"     Calculator               ",.F.,.F. })
aAdd(aMenu,{21,"Users                         ",.F.,.T. })
aAdd(aMenu,{22,"     Create User              ",.F.,.F. })
aAdd(aMenu,{23,"     Set user Permissions     ",.F.,.F. })

aClrCol:={ { 0, nRGB(192,221,255) }, { 0, nRGB(221,245,255) } } // Xbrowse Alternative Column colours

DEFINE DIALOG oDlg FROM 70,20 to 630,690 TITLE "Test" PIXEL 

@ 0,100 XBROWSE oBrwMenu ;
    COLUMNS 2, 3 ;
    HEADERS "Menu", "Status" ;
    OF oDlg ;
    ARRAY aMenu   // should not use AUTOCOLS now 

oBrwMenu:lHScroll:=.F.  // Horizontal Scroll Bar not required
oBrwMenu:lFooter:=.T.

// Sub Menu in different colour and Menu's in different Coclour
oBrwMenu:bClrStd := { || iif(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][4],aClrCol[1],aClrCol[2]) }
oBrwMenu:lUpdate   := .t. 
oBrwMenu:nColSel   := 2   
oBrwMenu:bGotFocus:={ || oBrwMenu:nColSel:= 2 }
oBrwMenu:aCols[1]:nWidth:=350

// Easiest way to dispplay a BMP based on the Logical Value
*oBrwMenu:aCols[2]:SetCheck( { "CheckOn", "CheckOff" } ) 

// Alternative way to display BMP, if multiple conditions and more than 2 bitmaps are there
oBrwMenu:aCols[2]:AddResource("CheckOn")
oBrwMenu:aCols[2]:AddResource("CheckOff")

// Checkbox should be displayed only if the menu type is not a Submenu
oBrwMenu:aCols[2]:bBmpData :={ || iif(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][4],0,iif(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][3],1,2))  }

oBrwMenu:aCols[2]:nWidth:=50
oBrwMenu:aCols[2]:bStrData:={ || NIL }
oBrwMenu:aCols[2]:nDataStrAlign := AL_CENTER

// No edit for SubMenu
oBrwMenu:aCols[2]:bEditWhen  := { || iif(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][4],.F.,.T.) } 
// Edit Type is set to GET, other options are List,Button Etc.
oBrwMenu:aCols[2]:nEditType  := EDIT_GET
oBrwMenu:aCols[2]:bEditvalue := { || space(0) }
*oBrwMenu:aCols[2]:bEditvalue := { || if(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][3],"Disable ?","Enable ?") }
oBrwMenu:aCols[2]:bOnPostEdit:= { | oCol, xValue, nLastKey | MenuAccessOnEdit( oCol, xValue, nLastKey) }

// Enable user to click on the checkbox on column 2 only
oBrwMenu:bLClicked := { | nRow, nCol | iif(oBrwMenu:nColSel == 2,MenuAccessOnEdit(oBrwMenu:aCols[2],,),NIL) }

// Mouse Double Click event for the Whole column in this xBrowse
oBrwMenu:bLDblClick:={|nRow, nCol| if(nCol == 2, .F., ),MsgInfo("Test"),oBrwMenu:Refresh(),.T.}  

// Mouse Double Click event for Column 2 of this xBrowse
*oBrwMenu:aCols[2]:bLDClickData := { |nRow,nCol| if(oBrwMenu:nColSel == 2,  PostMessage( oBrwMenu:hWnd, WM_KEYDOWN, 27 ),) }
*oBrwMenu:aCols[2]:bLDClickData := {|nRow, nCol| if(nCol == 2, .F., ),MsgInfo("Test"),oBrwMenu:Refresh()} 

// 2nd Column should be the selected column to do the PostMessage with an ESC key, or else ESC key closes the dialog itself
// Also make sure that Postmessage should work only on 2 conditions ie
// It should be a menu item and not Sumbenu Item
*oBrwMenu:bKeyDown= {|nKey| if(oBrwMenu:nColSel == 2,if ( nKey  == VK_RETURN, PostMessage( oBrwMenu:hWnd, WM_KEYDOWN, 27 ), ),) } 

oBrwMenu:bKeyDown= {|nKey| if(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][4], , ; // Is submenu the do nothing, bwhen will take care
							   ( oBrwMenu:nColSel:=2 ,;  // else ie Menu items
							     if ( nKey  == VK_RETURN, PostMessage( oBrwMenu:hWnd, WM_KEYDOWN, 27 ), ) ;
							    ) ) } 
							    
oBrwMenu:CreateFromCode() 

@14.3,05 BUTTONBMP oBtnCancel PROMPT "Cancel" OF oDlg TEXTRIGHT BITMAP "Cancel24x24" ;
	SIZE 50,15 ACTION oDlg:End()	   
	
ACTIVATE DIALOG oDlg CENTERED ;
	ON INIT ( oBrwMenu:nLeft:=220,oBrwMenu:nHeight:=oDlg:nHeight-35,oBrwMenu:nWidth:=450,;
			 oBrwMenu:SetFocus()  ) 

Return  

*---------------------------------------------*
Function MenuAccessOnEdit( oCol, xValue, nLastKey )
*---------------------------------------------*
Local oBrw  := oCol:oBrw
if oBrw:aArrayData[oBrw:nArrayAt][3]  // .T.
	oBrw:aArrayData[oBrw:nArrayAt][3]:=.F.
else
	oBrw:aArrayData[oBrw:nArrayAt][3]:=.T.
Endif
oBrw:Refresh()
Return NIL



TestXbr.Rc
CheckOn              BITMAP  C:\FWH\Bitmaps\CheckOn.Bmp
CheckOff             BITMAP  C:\FWH\Bitmaps\CheckOff.Bmp


You may substitute the your FWH installation path in the .RC

Meanwhile I shall test the code which u have given in the your last post.

Regards

Anser
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 11:45 AM

Dear Sambomb,

Thankyou for your support but Not successful. GET is getting activated when double clicking the 2nd column ie Status

Regards

Anser

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 11:55 AM
Dear Sambomb

I changed the code to

---------------------------------------------*
Function EditTest(oBrwMenu)
*---------------------------------------------*
Local Result := .F.
if  oBrwMenu:aArrayData[oBrwMenu:nArrayAt][4]
   Result := .F.
else
   Result := .T.
end

/*
if oBrwMenu:oCapCol == 2
   Result := .F.
end
*/
if oBrwMenu:nColSel == 2
   Result := .F.
end
Return Result


Now double click is not getting activated but, If I use enter key to change the value of status, the dialog is getting closed.

I tried removing the line

oBrwMenu:bKeyDown= {|nKey| if(oBrwMenu:aArrayData[oBrwMenu:nArrayAt][4], , ; // Is submenu the do nothing, bwhen will take care
							   ( oBrwMenu:nColSel:=2 ,;  // else ie Menu items
							     if ( nKey  == VK_RETURN, PostMessage( oBrwMenu:hWnd, WM_KEYDOWN, 27 ), ) ;
							    ) ) }


But after removing bKeyDown I am not able to change the status using ENTER KEY

Regards

Anser
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 12:02 PM
This give me a error in line 42:


    38-@ 0,100  XBROWSE oBrwMenu ;
    39-             COLUMNS 2, 3 ;
    40-             HEADERS "Menu", "Status";
    41-             OF oDlg ;
    42-             ARRAY aMenu   // should not use AUTOCOLS now

    [/list:u]

    Syntax erro: syntax error at '{'
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 12:08 PM

Dear Sambomb,

I think you must have missed some lines while copy pasting.

I once again created a test.prg by selecting (copy/paste) the code from the post which I have made. It compiled perfectly without any errors and worked.

Can u please check it once more

Regards

Anser

Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 12:18 PM

Still give me the same error, are you using any lib?

Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Disable mouse double click event on xBrowse ? (Solved)
Posted: Thu Dec 18, 2008 12:30 PM
Dear Sambomb,

I am using the Original Lib's which came along with FWH ver 8.08

The Sample PRG which I posted above is compile and linked using the BuildX.Bat which came along with FWH\Samples

Looking at the code there is no syntax error

      38-@ 0,100  XBROWSE oBrwMenu ;
      39-             COLUMNS 2, 3 ;
      40-             HEADERS "Menu", "Status";
      41-             OF oDlg ;
      42-             ARRAY aMenu   // should not use AUTOCOLS now



Syntax erro: syntax error at '{'


Regards

Anser