Skip to main content
guest
Join | Help | Sign In
Liberty BASIC Programmer's Encyc Home
guest| Join | Help | Sign In
Liberty BASIC Programmer's Encyc
  • Wiki Home
  • Recent Changes
  • Pages and Files
  • Members

Home

General Tutorials
Advanced Tutorials
GUI Programming
Graphics and Games
Strings and Text
Numbers and Math
Using Files
Windows API
Communications
Programmer's Tools

Articles by Date
FAQs
Rosetta Code
General Articles
Newsletters Contents

Table of Contents
Demos

Submit Articles
TOS and License

ListBox_single_and_double_click

Edit 4 …
  • 0 Tags
    • No tags
  • Notify
  • RSS
  • Backlinks
  • Source
  • Print
  • Export (PDF)
Older Version Newer Version

StPendl StPendl Sep 10, 2007 - "Initial page"

How to have a single and a double click handler for a listbox

- StPendl StPendl Sep 10, 2007

Most people do not know, that a listbox can respond to a single-click by setting the singleClickSelect property.
You can have a different event handler for single-clicks by adding a branch label ( singleClickSelect [action] ) too.

The problem we have, when using both event handlers, is to know which one to use, because Windows sends the single-click and double-click messages to the control, when double-clicking a listbox item.

Here is a demo for using both event handlers based on the Double Click Demo in Newsletter 126

 nomainwin 

for i = 1 to 10
array$(i) = str$(i)
next

listbox #m.lb, array$(, [DoubleClickAction], 10, 10, 200, 200
statictext #m.txt, "Select an item or double click it.", 10, 220, 200, 20

open "test listbox event handlers" for window as #m
#m "trapclose [quit]"
#m.lb "singleClickSelect [SingleClickAction]"
wait

[SingleClickAction]
calldll #user32, "GetDoubleClickTime", delay as ulong
timer delay, [continue]
wait

[continue]
timer 0
#m.txt "Single Click Action"
wait

[DoubleClickAction]
timer 0
#m.txt "Double Click Action"
wait

[quit]
close #m
end
Help · About · Pricing · Privacy · Terms · Support · Upgrade
Contributions to https://lbpe.wikispaces.com/ are licensed under a Custom License.
Portions not contributed by visitors are Copyright 2018 Tangient LLC
TES: The largest network of teachers in the world
Turn off "Getting Started"
  1. Home
  2. ...
Loading...