In notes client I am using a list box. When i put items in the list box (script) it shows small boxes (check boxes) on the left. Any way to turn them off? its a read only list too
Subject: List box - remove boxes
Not that I know of.
I normally have two fields:
One that is List field that you see when in edit mode where the user can select things and hidden in read mode.
Then I have a second field (computed for display) who’s value is set to the first field and is just a text field, multiple value, that is hidden in edit more and displays in read mode.
Subject: RE: List box - remove boxes
maybe i shouldnt use a list box… i only want single select… what im trying to do is use it to a user can reorganize the list by pushing an up or down arrow… suggestions?
Subject: RE: List box - remove boxes
maybe i shouldnt use a list box… i only want single select… what im trying to do is use it to a user can reorganize the list by pushing an up or down arrow… suggestions?
An editable listbox is the correct choice. Just let the user select a single value, not multiple values.
Use a hidden, multivalue field for the values, and make that field the value list for the listbox. Check ‘refresh values upon document refresh’. That way, when the source field changes, the listbox changes. That is, the values appear in their new order.
Put an up and a down arrow next to the listbox. Overlay these with hotspots. The hotspots can be formula or Lotusscript.
Using Formula, it would be roughly as follows:
REM “The Down or Move Back hotspot”;
bail1 := @If(TheListbox=“”;@Return(“”);“”);
bail2 := @If(TheListbox = TheSourcefield[1];@Return(“”);“”);
index := @Member( TheListbox ; TheSourcefield );
FIELD TheSourceField := @Subset(TheSourcefield;index-2):
TheListbox:
TheSourceField[index-1]:
@Subset(TheSourcefield;-(@Elements(TheSourceField)-index))
@Command([ViewRefreshfields])
That’s the general idea anyway: reconstruct the source field, switching the selected element and the one behind it, and tack on everything after that, and then refresh the form.
The selected element should remain selected, I don’t think you have to do anything there.
Or you could do this with Lotusscript, which would be roughly as follows:
’ The Back hotspot
dim ws as notesuiworkspace
dim uidoc as notesuidocument
dim ind as variant
dim item as notesitem
dim newarray() as string
dim selection as string
dim previousvalue as string
dim i as integer, n as integer
set ws = new notesuiworkspace
set uidoc = ws.currentdocument
selection = uidoc.fieldgettext(“TheListbox”)
set item = uidoc.document.getfirstitem(“TheSourcefield”)
if selection = “” then exit sub
if selection = item.values(0) then exit sub
n = ubound(item.values)
redim newarray(n-1) as string
for i = 0 to n ’ fill up the array with the existing values
newarray(i) = item.values(i)
next i
index = arraygetindex(item.values, selection, 5) ’ This returns a Long
previousvalue = newarray(cint(index)-1)
newarray(cint(index)-1) = selection
newarray(cint(index)) = previousvalue
with uidoc
’ use whatever is the value delimiter on TheSourcefield. Probably a semicolon.
call .fieldsettext(“TheSourceField”, Join(newarray, “;”))
call .refresh
end with
It would be more efficient to make ws and uidoc global variables so you don’t re-instantiate them all the time.
Subject: RE: List box - remove boxes
Not sure about the reorganizing, but the single select, you can do be removing the checkmark “Allow multiple values” in the field properties dialog.
Subject: RE: List box - remove boxes
Thats exactly what I was looking for. For some reason I thought I had to have that checked. I already have the code for the up and down buttons but thanks for the posts…
Subject: RE: List box - remove boxes
one more thing… is there a way to keep the selection after the user moves an item in the list… this way they dont have to keep selecting if they wanted to move 1 item all the way down they would just keep hitting the down button …