Example Program - Setting the mouse action for grid cells
The following program creates a small grid full of random numbers. While creating the grid the default mouse action for each cell is set so that the user can select whole rows by left clicking on the grid and whole columns by right clicking on the grid.
DEFFORM Form1()={.form,.form$,.Style=0x50C000C4,.Width=310,.Height=196,.Text$="Mouse left and right actions",.Id=1024},\ {.ok,.button$,.Style=0x50010001,.Left=255,.Top=6,.Width=50,.Height=14,.Text$="OK",.__Anchor=5,.Id=1},\ {.cancel,.button$,.Style=0x50010000,.Left=255,.Top=23,.Width=50,.Height=14,.Text$="Cancel",.__Anchor=5,.Id=2},\ {.txtControl1,.static$,.Style=0x50000000,.Left=18,.Top=130,.Width=197,.Height=55,.Text$="When you left click on a cell the whole row is selected, right click on a cell and the whole column is selected. This is done with the LeftAction, RightAction, LeftSelect and RightSelect properties.",.Id=1001},\ {.GridControl1,.KCMLgrid$,.Style=0x50010030,.Left=11,.Top=7,.Width=237,.Height=113,.Id=1000,.Rows=10,.Cols=8,.FixedRows=1} DEFEVENT Form1.Enter() LOCAL DIM row,col FOR row = 1 TO 10 FOR col = 1 TO 8 IF (col == 1) .GridControl1.Cell(row, col).Text$ = row CONTINUE END IF .GridControl1.Cell(row, col).Text$ = INT(RND(1) * 1000) .GridControl1.Cell.LeftAction = &.Click .GridControl1.Cell.RightAction = &.Click .GridControl1.LeftSelect = &.Row .GridControl1.RightSelect = &.Col NEXT col NEXT row END EVENT FORM END Form1 Form1.Open()