realbasic-nug
[Top] [All Lists]

Re: Contextual click on listbox header

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Contextual click on listbox header
From: Norman Palardy <npalardy@great-white-software.com>
Date: Fri, 27 Feb 2009 08:42:15 -0700
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <87A5F73F-B354-47AA-971D-36618335563A@online.de>
References: <E1D852E9-A6DB-421A-9438-85A69E61256C@gsco.de> <F2EF08E6-1F4C-4B93-BE3C-BFDF618F08D2@online.de> <68B26588-48EE-4480-9305-2AB7D0692EA6@stretchedout.com> <87A5F73F-B354-47AA-971D-36618335563A@online.de>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com

On 27-Feb-09, at 7:37 AM, Christian Dorn wrote:


Am 27.02.2009 um 15:18 schrieb Greg O'Lone:

Interestingly, if you try to do this:

dim col as integer
col = me.ColumnFromXY(x,y)

in the MouseDown event, you get -1 I'd expect it to be able to figure out which column you clicked....

Yes, I found this, too. But you can get the right column by adding up the WidthActual properties of the columns:

 dim column, w, count as Integer
 column = -1
 count = me.ColumnCount-1

 for i as Integer = 0 to count
   w = w + me.Column(i).WidthActual
   if w >= x then
     column = i
     exit
   end if
 next i

Or adjust Y so it's in the content area of the listbox

   dim col as integer
   col = me.ColumnFromXY(x,headerHeight + 1)

Once you have data in a listbox code like this will figure out the headherheight

  dim headerHeight as integer = 0
  if listbox1.hasHeading then
    dim i as integer = listbox1.rowFromXY(1,headerHeight)
    while listbox1.rowFromXY(1,headerHeight) < 0
      headerHeight = headerHeight + 1
    wend
    headerHeight = headerHeight - 1
  end if



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>