I am trying to find out where the cursor is placed in a multi-value field. I am looking for something that behaves sililarly to fieldname = uidoc.Currentfield but this only returns the field name. I need something that will return the place in the array. For example, if my field is called Field1 and it has 5 values: 1,2,3,4,5 and my cursor was placed at the ‘2’ I would want something to return to me Field1(1).
Is there some way I can get this?
Any help is appreciated.
Subject: How to find out where cursor is placed in multi-value field?
hide Field1.
Create a field called selectField1. Make this a single-value dialog list. Have the choices computed by formula, the formula being “Field1”. Make sure the choices are refreshed on a document refresh.
When the user clicks your button, figure out which value of selectField1 was selected. Modify Field1 accordingly. Refresh the form.
Subject: How to find out where cursor is placed in multi-value field?
In the big picture, what exactly are you trying to accomplish? Formula? LotusScript? JavaScript? Java?
If you are using LotusScript, all you know is what is the selected value. One way around this would be to use a hidden field to hold all the field choices, and reference this field in the formula for the field choices.
Then you could do something like this as one option (apologies for sloppy code but the mind is not quite awake yet)
dim varChoices as Variant
varChoices=doc.GetFirstItem(“HiddenChoicesField”)
dim strSelected as string
strSelected=doc.FieldBeingTested(0)
dim iChoice as integer
iChoice=-1
dim strPosition as string
forall c in varchoices
ichoice=iChoice+1
if c=strSelected then
strPosition=Cstr(iChoice)
end if
end forall
Subject: RE: How to find out where cursor is placed in multi-value field?
Sorry about that…I should have been more clear about what I am trying to accomplish. I am using LotusScript and I have a multi-value field. My users want to be able to place their cursor at one of the values and click a button (which runs LotusScript) and have the value that is “selected” be propagated to all of the values after that one. Here is an example. I have a field called Field1 which contains values 1,2,3,4,5. If I put my cursor at the 2 and click on the “Populate to End” button the field will take on the values: 1,2,2,2,2. So, I need to find out where the cursor is. And this is not a field that has choices. This is an editable number field which contains multi-values. The user wants to be able to place their cursor at any value, not just the second value. Do you know of any way I can find out where the cursor is in the field?Thank you.
Subject: RE: How to find out where cursor is placed in multi-value field?
Oh good lord…i will have to ponder this…why not make it a combo box or dialog list?
Subject: RE: How to find out where cursor is placed in multi-value field?
I can’t make it a combo box or a dialog list. These numbers represent a number for each month of the year. There are 12 numbers and they have to be in order and each number could be any number from 00.00 to 99.99. I had to make it a multi-value field in order to make serveral other design aspects within views, etc, work the way the users want it to. I know, this is a tricky one. Thank you for pondering this!
Subject: RE: How to find out where cursor is placed in multi-value field?
OK…are the values just set once? If so, have this field poulate the choices of a dialog box (or even checkboxes for subsequent edits. If yoiu need to change the values of the field, have a button that does it. I still do not iundertsand why you had to design the field the eay you did as a DialogList can be multivalue as well…
Subject: How to find out where cursor is placed in multi-value field?
It depends. If the field only allows one value to be selected at a time, then the value of the field almost always tells you where the cursor is. The exception is when nothing is selected, but the cursor has entered the field. You can use the field’s Entering event to detect this.If the field allows multiple values, then LotusScript does not know where the cursor is. LotusScript only knows which values are selected. You can work around this by using two fields, forcing the user to select values one at a time and press a button for each.