Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - SOLVED: Show Yes,No not True,False in Item
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SOLVED: Show Yes,No not True,False in Item

 Post Reply Post Reply
Author
Message
mstuart View Drop Down
Groupie
Groupie


Joined: 06 April 2010
Location: United States
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote mstuart Quote  Post ReplyReply Direct Link To This Post Topic: SOLVED: Show Yes,No not True,False in Item
    Posted: 13 April 2010 at 7:13pm
Hi all,
How do I "swap" out the default True,False for Yes,No in the Constraints for a PropertyItemBool type Item?

I've added the constraints, but the result is 4 options:
True,False,Yes,No.

I know I could probably make the Item a PropertyItemString, but the Data wouldn't be boolean True/False.

Regards,
Mark Stuart

Product: Xtreme SuitePro (ActiveX) v13.2.1
Platform: WinXP (32bit)/Win7 (64bit)
Language: VB6 (SP6), Magic eDeveloper v9.4, uniPaaS v1.9
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 15 April 2010 at 5:02pm
Hi,
 
To get rid of the True & False constraints just call Item.Constraints.Remove before adding constraints "Yes" & "No"
 
Or
 
The propertyGridItemBool actually has 2 constraints already so you could:
 
Dim Item As PropertyGridItem
Set Item = Category.AddChildItem(PropertyItemBool, "Bool", 0)
        Item.Constraints(1).Caption = "Yes"
        Item.Constraints(2).Caption = "No"
       
 
but you aren't able to select Yes  I would expect this to work but it doesn't
 
 
Better use Enum instead but then again you have to check value in ValueChanged event.
 
Dim Item As PropertyGridItem
Set Item = Category.AddChildItem(PropertyItemEnum, "Enum", "")
      Item.Constraints.Add "Yes", True                                                    'for readability actual value = -1
      Item.Constraints.Add "No", False                                                    'for readability actual value = 0
      Item.Flags = 0                                                                                  'Only allow selection with arrow
      Item.Id = PROPITEM_ENUM
 
 
Private Sub wndPropertyGridFiles_ValueChanged(ByVal Item As XtremePropertyGrid.IPropertyGridItem)
        Select case Item.Id
            Case PROPITEM_ENUM
                Debug.Print CBool(Item.Value)
        End Select
End Sub
 
Hope this helps
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
mstuart View Drop Down
Groupie
Groupie


Joined: 06 April 2010
Location: United States
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote mstuart Quote  Post ReplyReply Direct Link To This Post Posted: 15 April 2010 at 5:42pm
Hi Aaron,

I've taken the easier path by using a string item and using "Yes","No". I then check the PropertyGrid_ValueChanged() event to do what I need to do.

Regards,
Mark Stuart

Product: Xtreme SuitePro (ActiveX) v13.2.1
Platform: WinXP (32bit)/Win7 (64bit)
Language: VB6 (SP6), Magic eDeveloper v9.4, uniPaaS v1.9
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.188 seconds.