Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Item Value Not Displaying
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Item Value Not Displaying

 Post Reply Post Reply
Author
Message
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Topic: Item Value Not Displaying
    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!
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2006 at 3:31pm
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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2006 at 3:39pm
How about Column.EditOptions.Constraints(1).Caption ?

--
WBR,
Serge
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2006 at 3:43pm
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.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2006 at 3:59pm
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
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2006 at 4:03pm
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.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2006 at 4:29pm
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
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2006 at 5:05pm
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.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 06 September 2006 at 1:29pm
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
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 06 September 2006 at 1:58pm
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. 
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 30 November 2006 at 3:36pm
Will this be added in 10.4?  Seems like it should be pretty easy to add and very useful for users.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.