Hi,

Based on the tip op Chip (sounds nice😊), I have created a function that can be 
used in the "On Column Resize" event:


C_TEXT($listbox;$1)
C_BOOLEAN($mouse_in_listbox;$0)
$listbox:=$1

C_BOOLEAN($mouse_in_listbox)
GET MOUSE($mouseX;$mouseY;$mouseButton)
OBJECT GET COORDINATES(*;$listbox;$l;$t;$r;$b)

If ($mouseX>=$l) & ($mouseX<=$r) & ($mouseY>=$t) & ($mouseY<=$b)
        $mouse_in_listbox:=True
Else 
        $mouse_in_listbox:=False
End if 

$0:=$mouse_in_listbox




> -----Oorspronkelijk bericht-----
> Van: Piotr Chabot Stadhouders [mailto:p.stadhoud...@timeff.com]
> Verzonden: vrijdag 5 januari 2018 10:06
> Aan: 4D iNug Technical <4d_tech@lists.4d.com>
> Onderwerp: RE: On Column Resize event
> 
> Hi Chip, Miyako,
> 
> @Chip :
> Thanks, this is a nice tip!
> But don't you agree it should be easier, and 4D should have thought about 
> this,
> and implement it another way?
> 
> @Miyako :
> I know there is a new auto-resize feature, but this works not as how we want 
> it
> In fact we have implemented an auto-resize feature ourselves, and this is
> exactly why we have a problem now When a user resizes a column we
> determine the ratio's of the column widths (We do this in the "On Column
> Resize" event) When resizing the listbox (by resizing the window for example)
> in the "On Resize" event we set the widths proportionally based on the ratio's
> calculated earlier
> 
> Gr,
> 
> Piotr
> 
> > -----Oorspronkelijk bericht-----
> > Van: Chip Scheide [mailto:4d_o...@pghrepository.org]
> > Verzonden: donderdag 4 januari 2018 18:22
> > Aan: 4D iNug Technical <4d_tech@lists.4d.com>
> > CC: Piotr Chabot Stadhouders <p.stadhoud...@timeff.com>
> > Onderwerp: Re: On Column Resize event
> >
> > Piotr,
> > 'On Timer' can be used to limit execution of the On Column Resize event.
> > I have seen a similar problem with other resizing situations.
> >
> > Basically - you start a timer for a .5 second or so, then On timer
> > executes the code.
> > This reduces the number of times the code runs.
> >
> > For differentiating between manual resizing of a column vs auto
> > resizing via a window resize, you could try setting a flag. Set the
> > flag in 'On Mouse Enter', and clearing it in 'On Mouse Leave', in the
> > context of the listbox. Then in the code for resizing if the flag is
> > set the user has the mouse in the listbox and is resizing manually. If not, 
> > then
> the user is resizing the window.
> >
> > Chip
> > On Thu, 4 Jan 2018 17:13:23 +0000, Piotr Chabot Stadhouders via
> > 4D_Tech
> > wrote:
> > > Hi,
> > >
> > > In 4D v16 there is a new feature so an "On Column Resize" event is
> > > triggered "live" during resizing of a listbox:
> > > https://blog.4d.com/execute-action-upon-listbox-column-resizing/
> > >
> > > I have a lot of code behind that event in our application that now
> > > is executed too many times, so I don't like this at all. I have to
> > > eliminate this code, because it is based on the idea a user resizes
> > > the column.
> > >
> > > Apart from this fact, there is something else :
> > > When setting the Horizontal sizing option of the listbox to grow,
> > > the listbox grows when resizing the window, and the last column of
> > > the listbox is also resized. This is common beheviour What I don't
> > > like is that then the "On Column Resize" event also is fired, so now
> > > when resizing the window, the code behind the event is executed many
> > > times.
> > > What I don't understand is how I can know if the event is triggered
> > > by a user resizing the column, or if it is triggered by something
> > > else (in this case resizing the window)
> > >
> > > Does anybody know of a way to detect this?
> > >
> > > Gr,
> > >
> > > Piotr
> > >
> > >
> >
> ****************************************************************
> > ******
> > > 4D Internet Users Group (4D iNUG)
> > > FAQ:  http://lists.4d.com/faqnug.html
> > > Archive:  http://lists.4d.com/archives.html
> > > Options: http://lists.4d.com/mailman/options/4d_tech
> > > Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> > >
> >
> ****************************************************************
> > ******
> > ---------------
> > Gas is for washing parts
> > Alcohol is for drinkin'
> > Nitromethane is for racing
> 

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to