![xojo click and hold on a listbox xojo click and hold on a listbox](https://blog.xojo.com/wp-content/uploads/2016/07/RSSReaderUI.png)
The loop repeatedly calls three methods, each of which reads or writes a buffer and takes some action before returning. It runs like any other while loop in C that you've ever seen. I want to emphasize that this is not magic. DispatchMessage passes the message along to the appropriate procedure. There might be some more specific procedure that deals with this message. You might want that translated into "the numlock key was pressed".
#XOJO CLICK AND HOLD ON A LISTBOX CODE#
That message might be at too low a level for you for example, it might say that a key with a particular keyboard code number was pressed. Somewhere in the heart of every process that has a UI thread is a loop that looks remarkably like this one. What happens is up to the process it can choose to ignore the click, handle it in its own special way, or tell the operating system "go ahead and do whatever the default is for that kind of event." All this is typically driven by some of the simplest code you'll ever see: while(GetMessage(&msg, NULL, 0, 0) > 0) At some point, a process asks the operating system "did anything interesting happen recently?" and the operating system says "why yes, someone clicked this thing." The process then does whatever action is appropriate for that. When something happens, say, a mouse click on a button, the operating system makes a note of it.
#XOJO CLICK AND HOLD ON A LISTBOX WINDOWS#
The way that interactive user interfaces are built in Windows is quite straightforward. Private static void mouseUpEvent(object sender, MouseEventArgs e)Ī recent article from Fabulous Adventures in Coding provides this narrative, which might help answer your question:Ī surprising number of people have magical beliefs about how exactly applications respond to user inputs in Windows. Private static void mouseDownEvent(object sender, MouseEventArgs e) this does whatever you want to happen while clicking on the button Private static void loopTimerEvent(Object source, ElapsedEventArgs e) LoopTimer.Interval = 500 /interval in milliseconds
![xojo click and hold on a listbox xojo click and hold on a listbox](https://blog.xojo.com/wp-content/uploads/2017/05/2017-05-26_15-40-06.png)
If you want to use you can use the Timer.Elapsed event instead.Įxample (using ): using Timer = Then put the code you would normally put inside the loop in the Timer_Tick event. To avoid using threads you can add a Timer component on your form/control and simply enable it on mouse down and disable it on mouse up.