Disable single mouse click event for list box.

H

Hon Seng Phuah

Guest
I would like to know whether there is an option for me to disable the
single mouse click in hiCreateListBoxField.

For example, if a user clicks one's mouse (once only), the list box
shall not change the highlight if the list box has any selection. If
not selection prior to the single mouse click, no change is needed.

If the user double click one mouse, the list box should highlight the
user selection.

-HS Phuah
 
Hi HS,

This doesn't really sound like a good idea to me, because it will be a rather counterintuitive
behaviour - different from every other UI.

You can effectively do it by having a callback on the change of value, to stop it
being changed - you have to do some tricks so that the double click will know what
value you want to change it to.

I wrote some code to do this - when you try to click on a value, it changes it back to the
previous value, but records the value you clicked on so that if you then do a double-click,
it will really set it. It's a bit dirty, and I'd really recommend you don't do this!

abListBox() is the entry function below to try this.

Regards,

Andrew.

procedure(abCreateListBoxForm()
let((listbox choices)
choices='("one" "two" "three" "four" "five")
listbox=hiCreateListBoxField(
?name 'listbox
?changeCB "abListBoxReset(hiGetCurrentForm())"
?doubleClickCB "abListBoxAcceptChoice(hiGetCurrentForm())"
?choices choices
?numRows 6
)
hiCreateAppForm(
?name 'abListBoxForm
?fields list(listbox)
?formTitle "List Box Sample"
)
)
)

procedure(abListBox()
unless(boundp('abListBoxForm)
abCreateListBoxForm()
)
hiDisplayForm(abListBoxForm)
)

procedure(abListBoxReset(form)
unless(form->listbox->semaphore
; prevent the changeCB callback from being called whilst
; we are manipulating the value here
form->listbox->semaphore=t
; store the value that was clicked
form->listbox->clickedValue=form->listbox->value
; if the value is not the double-clicked value, reset it to that
unless(form->listbox->value==form->listbox->doubleClickValue
form->listbox->value=form->listbox->doubleClickValue
)
)
; reset the semaphore
form->listbox->semaphore=nil
)

procedure(abListBoxAcceptChoice(form)
; store the value that was accepted when a double click occurred
form->listbox->doubleClickValue=form->listbox->clickedValue
; and set the value
form->listbox->value=form->listbox->doubleClickValue
)


On 12 Apr 2004 23:44:19 -0700, hsphuah@usa.com (Hon Seng Phuah) wrote:

I would like to know whether there is an option for me to disable the
single mouse click in hiCreateListBoxField.

For example, if a user clicks one's mouse (once only), the list box
shall not change the highlight if the list box has any selection. If
not selection prior to the single mouse click, no change is needed.

If the user double click one mouse, the list box should highlight the
user selection.

-HS Phuah
--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd
 

Welcome to EDABoard.com

Sponsor

Back
Top