Subscribe Bookmark RSS Feed

Listbox - how to restore focus (remove dotted line)?

djhanson

Community Trekker

Joined:

Jun 23, 2011

Hi All, does anyone know if one can clear the focus, in other words remove the dotted line wrapped around the Listbox, after an element in the list has been selected?

I was hoping their was some obscure message I could send to the ListBox, like say:

lb1<<clear focus after click();

--or--

lb1<<deselect;

But both did not remove the dotted line.  The dotted line stays there until another Listbox element is selected (I'd like to remove it write after selection though).

thanks, dj

An example (e.g. how to clear the dotted line placed around the ListBox after the element has been selected):

list1 = {"apple","orange","banana"};

list2 = {"tomato","lettuce","peas"};

lb1 = listbox(list1);

lb2 = listbox(list2);

win1=new window("good stuff",

vlistbox(

textbox("fruit")

,

lb1

,

textbox("")

,

textbox("veggies")

,

lb2

)

);

1 REPLY
msharp

Super User

Joined:

Jul 28, 2015

I really feel this is a developer OCD issue and can't imagine a scenario where this would actually affect the end user in the slightest.

That being said, I'm not aware of a way to remove the focus, but as a work around you could always delete the box and remake it.  Something like this:

list1 = {"apple","orange","banana"};

list2 = {"tomato","lettuce","peas"};

lb = Function({list, tb},

  ::listforever = list;

  ::tbforever = tb;

  lbx = listbox(list);

  lbx << Set Script(lbx << Delete; lbx = lb(::listforever,::tbforever); ::tbforever << Sib Append(lbx));

  return(lbx);

);

lb2 = listbox(list2);

win1=new window("good stuff",

vlistbox(

tb1 = textbox("fruit")

,

lb1 = lb(list1,tb1)

,

textbox("")

,

textbox("veggies")

,

lb2

)

);

You would need to create separate functions for every listbox to avoid issues with overwriting the globals.