| 6/04/06 ~ 18:08 -0700 :
| Charles Ross,
| " Re: Cell as Popup Menu? "
While not exactly what I was hoping for, that might be sufficient for
the time being. Are you able to provide a sample of this technique?
With pleasure!
zegoodrow and zegoodcolumn are set elsewhere in code, they determine
which cell should get the menu, and the menu is populated elsewhere
(open event or initialization routines):
Function columnfromX(x as integer) As integer
//-1-->On empty space(no column)
//-2-->On vertical scrollbar
//-3-->Outside listbox
dim col,cw,a as integer
if (x<0) or (x>=TheListBox.width) then
return -3
elseif TheListBox.scrollbarVertical and (x>=width-15) then
return -2
end if
if TheListBox.columncount<1 then
return -1
end if
col=0
cw=TheListBox.column(0).widthactual
a=TheListBox.columncount-1
while (cw<x) and (col>-1)
if (col=a) then
col=-1
else
col=col+1
cw=cw+TheListBox.column(col).widthactual
end if
wend
if (col<0) or (col>=TheListBox.columncount) then
return -1
end if
return col
End Function
Function rowfromY(y as integer) As integer
//-1-->On empty space(no row)
//-2-->On horizontal scrollbar
//-3-->Outside listbox
//-4-->On heading
dim i,rh,headheight,height as integer
height = TheListBox.Height
if (y<0) or (y>=height) then
return -3
elseif TheListBox.hasheading and (y<=18) then
return -4
elseif TheListBox.scrollbarhorizontal and (y>=height-15) then
return -2
end if
if TheListBox.listcount<1 then
return -1
end if
if TheListBox.hasheading then
i=18
else
i=0
end if
rh = TheListBox.DefaultRowHeight
i=TheListBox.scrollposition+floor(((y-i)/rh))
if (i>=TheListBox.listcount) or (i<0) then
return -1
end if
return i
End Function
Function MouseDown(X As Integer, Y As Integer) As Boolean
dim zerow, zecol as integer
zerow = RowfromY(y)
zecol = ColumnfromX(x)
if zerow = TheListBox.ListIndex and zerow > -1 then
if zerow = thegoodrow and zecol = zegoodcolumn then
TheContextMenu.Open
end
end
End Function
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>