Print Page | Close Window

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

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=16585
Printed Date: 29 April 2024 at 4:29am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SOLVED: Show Yes,No not True,False in Item
Posted By: mstuart
Subject: SOLVED: Show Yes,No not True,False in Item
Date 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



Replies:
Posted By: Aaron
Date 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....


Posted By: mstuart
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net