Disable mouse double click event on xBrowse ? (Solved)

Disable mouse double click event on xBrowse ? (Solved)

Postby anserkk » Wed Dec 17, 2008 8: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
Last edited by anserkk on Sat Dec 20, 2008 10:52 am, edited 3 times in total.
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby anserkk » Wed Dec 17, 2008 8: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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby sambomb » Wed Dec 17, 2008 7:06 pm

Code: Select all  Expand view

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
User avatar
sambomb
 
Posts: 388
Joined: Mon Oct 13, 2008 11:26 am
Location: Itaocara - RJ - Brasil

Postby anserkk » Thu Dec 18, 2008 6:28 am

Dear Sambomb,

Unfortunately the mouse double click is still activating the GET

code tried as per your suggestion

Code: Select all  Expand view
// 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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby anserkk » Thu Dec 18, 2008 9: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

Code: Select all  Expand view
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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby sambomb » Thu Dec 18, 2008 10:33 am

Code: Select all  Expand view
   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
User avatar
sambomb
 
Posts: 388
Joined: Mon Oct 13, 2008 11:26 am
Location: Itaocara - RJ - Brasil

Postby anserkk » Thu Dec 18, 2008 11:09 am

Dear sambomb

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


Code: Select all  Expand view
// 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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby sambomb » 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


Code: Select all  Expand view
// 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

Code: Select all  Expand view
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
User avatar
sambomb
 
Posts: 388
Joined: Mon Oct 13, 2008 11:26 am
Location: Itaocara - RJ - Brasil

Postby anserkk » 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
Code: Select all  Expand view
#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
Code: Select all  Expand view
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
Last edited by anserkk on Thu Dec 18, 2008 11:46 am, edited 1 time in total.
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby anserkk » 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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby anserkk » Thu Dec 18, 2008 11:55 am

Dear Sambomb

I changed the code to

Code: Select all  Expand view
---------------------------------------------*
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

Code: Select all  Expand view
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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby sambomb » Thu Dec 18, 2008 12:02 pm

This give me a error in line 42:

    Code: Select all  Expand view
    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 '{'
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
User avatar
sambomb
 
Posts: 388
Joined: Mon Oct 13, 2008 11:26 am
Location: Itaocara - RJ - Brasil

Postby anserkk » 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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby sambomb » 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
User avatar
sambomb
 
Posts: 388
Joined: Mon Oct 13, 2008 11:26 am
Location: Itaocara - RJ - Brasil

Postby anserkk » 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

Code: Select all  Expand view
      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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 20 guests