Item Value Not Displaying |
Post Reply |
Author | |
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
Posted: 05 September 2006 at 2:50pm |
I have the following code:
Set Item = Record.AddItem("(None)") Item.CreateEditOptions Item.EditOptions.AddComboButton Item.EditOptions.ConstraintEdit = True Item.EditOptions.Constraints.Add "True", True Item.EditOptions.Constraints.Add "False", False When I run it the value in the columns does not Display "(None)" as I would expect although the combo is present with the values "True" and "False" If I remove the 5 lines that begin with Item. then the value "(None)" appears but I have no combo (and I would not expect a combo here). Can someone tell me how to get the value "(None)" to appear along with the combo values? Thanks! |
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
Ok, I figured it out using Column.EditOptions.
However, if I add a constraint to the column such as: Column.EditOptions.Constraints.Add "Employee Name 1", 1 Column.EditOptions.Constraints.Add "Employee Name 2", 2 How do I get to the data value? If I use the ValueChanged event to display the caption and value it is returning "Employee Name 2" as the value and empty string as the caption. I expected it to return 2 as the value and "Employee Name 2" as the caption. I must be missing something. Help! Thanks |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
How about Column.EditOptions.Constraints(1).Caption ?
-- WBR, Serge |
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
So how do I know that the user clicked on the first item? I need to return the value and caption of the item that the user clicks on in the combo.
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
For sure you know an id if the constraint: it is Item.Value
So far to check this yuou can use something like: MsgBox Column.EditOptions.Constraints(Item.Value).Caption -- WBR, Serge |
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
Nope. Item.Value is returning "Employee Name 2" (if I click on that item). So if I use Item.Value in Column.EditOptions.Constraints(Item.Value).Caption then I get a type mismatch.
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Ok, it could depend on initializing editing options of the Column or Item.
For me it works fine for example in ReportSample / Task List form / ValueChanged handler / Status Column. What is your initialization code? -- WBR, Serge |
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
Ok, we're getting there. I had to set .Constraint.Edit = True and then manually set the caption for each row but that part works.
However, the task example does return what you would expect but only because the data values happen to be the same as the order that they were placed in the combo. Try switching the first 2 items: Column.EditOptions.Constraints.Add "In Progress", taskStatusInProgress Column.EditOptions.Constraints.Add "Not Started", taskStatusNotStarted Then when you check the value and caption using: MsgBox "Value: " & Item.Value & " Caption: " & Column.EditOptions.Constraints(Item.Value).Caption in the valuechanged event, the first to items will return incorrect captions. |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Ok, agree with you. This is what sample wanted to show -- strictly organized constraints array.
Looks like in your case you'll have whether to iterate all constraints to find a required one, or to have an additional map to constraints index... -- WBR, Serge |
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
So is there any way that this can be "fixed" in 10.3.1? It seems like common sense to have a combo act like the regular VB combobox with itemdata.
|
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
Will this be added in 10.4? Seems like it should be pretty easy to add and very useful for users.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |