1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Table - MouseDown event and more

Discussion in 'Code Samples & Tips' started by Erel, Apr 6, 2008.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Using the new Door library it is now possible to improve the Table control.
    With the following code you can add a new event, the MouseDown event.
    The HitTest sub will return the pressed row and column (along with the control's part type).

    With this sub you can find the index of the first visible row (this issue was discussed several times in the forum).

    You should include the door library: http://www.basic4ppc.com/forum/showthread.php?t=2038

    The code is attached.
    Sub Globals
    End Sub

    Sub App_Start
    For i = 1 To 10
    End Sub

    Sub AddMouseDownEvent(TableName)
    End Sub
    Sub event_NewEvent
        o.Value = 
    End Sub
    Sub HitTest(TableName,x,y)
        o.Value = obj.RunMethod3(
    "X: " & x & " Y: " & y)
    "Row: " & o.GetProperty("Row"))
    "Column: " & o.GetProperty("Column"))
    "Type: " & o.GetProperty("Type"))
    End Sub

    Sub SetAlternateRowsColor (TableName,Color)
    If CPPC Then Return 'devices do not support this method
    "System.Drawing.Color" & o.System_Drawing)
        o.Value = o.RunMethod2(
        obj.Value = obj.GetProperty(
        obj.Value = obj.GetProperty2(
    "AlternatingBackColor", o.Value)
    End Sub

    Attached Files:

  2. specci48

    specci48 Well-Known Member Licensed User

    Marvellous tip Erel. :sign0060:
    Remembering some very old threads I think that a lot of "coders" will very pleased by this example.

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice