Adding button |
Post Reply |
Author | |
madness
Newbie Joined: 08 June 2010 Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 08 June 2010 at 3:44pm |
Hello,
I am new to codejock and am trying to add a button to property grid item. I am trying to base this on the samples provided with the product, but am not having much luck. If anyone could provide a code sample on how to do this, as well as other links to some tutorials, it would be much appreciated.
I am trying this with version 13.3.1 with VB.NET 4.0.
Category = Me.AddressPropertyGrid.AddCategory(A.Location_Name.ToString)Dim istring As String
istring = A.Location_Name.ToString 'dr("location_name")Item = Category.AddChildItem(XtremePropertyGrid. PropertyItemType.PropertyItemString, "Location Name", A.Location_Name)Item.ReadOnly = FalseItem.EditStyle = PropertyItemEditStyle.EditStyleLeftItem.Flags = PropertyItemFlags.ItemHasEdit Or PropertyItemFlags.ItemHasExpandButtonItem.Id = 9 Dim Button As XtremePropertyGrid.PropertyGridInplaceButtonButton = Item.AddInplaceButton(1) Button.Caption = "Test Button"Button.Enabled = True Thanks, Madness |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Here is some c# code to do the same:
//Inplace Buttons Type Samples Category = wndPropertyGrid.AddCategory("Inplace Buttons"); Item = Category.AddChildItem(PropertyItemType.PropertyItemBool, "Combo Button", true); Item = Category.AddChildItem(PropertyItemType.PropertyItemString, "Expand Button", ""); Item.Flags = PropertyItemFlags.ItemHasEdit | PropertyItemFlags.ItemHasExpandButton; Item = Category.AddChildItem(PropertyItemType.PropertyItemString, "2 Buttons", ""); Item.Flags = PropertyItemFlags.ItemHasEdit | PropertyItemFlags.ItemHasExpandButton | PropertyItemFlags.ItemHasComboButton; Item.Constraints.Add ("Windows 98", 1); Item.Constraints.Add ("Windows 2000", 2); PropertyGridInplaceButton Button; Item = Category.AddChildItem(PropertyItemType.PropertyItemString, "Text Button", ""); Button = Item.AddInplaceButton(1); Button.Caption = "Find"; Item = Category.AddChildItem(PropertyItemType.PropertyItemString, "Image Button", ""); Button = Item.AddInplaceButton(1); Button.IconIndex = 10; Button.Tooltip = "Click to set filter"; wndPropertyGrid.Icons.MaskColor = (uint)HexToDecimal("C8D0D4"); wndPropertyGrid.Icons.LoadBitmap(IconsPath() + "Filter.bmp", 10, XTPImageState.xtpImageNormal); Item = Category.AddChildItem(PropertyItemType.PropertyItemString, "Menu Button", ""); Item.Flags = PropertyItemFlags.ItemHasComboButton | PropertyItemFlags.ItemHasEdit; Item.Id = ITEM_MENUBUTTON; Item = Category.AddChildItem(PropertyItemType.PropertyItemNumber, "Slider Control", 10); PropertyGridInplaceSliderControl SliderCtrl; SliderCtrl = (PropertyGridInplaceSliderControl)Item.AddSliderControl(); SliderCtrl.Max = 200; Item = Category.AddChildItem(PropertyItemType.PropertyItemNumber, "Spin Button", 10); PropertyGridInplaceSpinButton SpinButton; SpinButton = (PropertyGridInplaceSpinButton)Item.AddSpinButton(); SpinButton.Max = 50; Item = Category.AddChildItem(PropertyItemType.PropertyItemString, "Hyperlink Button", ""); Item.Flags = 0; Button = Item.InplaceButtons.Add(1); Button.Hyperlink = true; Button.ShowAlways = true; Button.Alignment = 0; Button.Caption = "Click Me"; Button.Width = 0 ; // Auto and how to respond to the clicks: private void wndPropertyGrid_InplaceButtonDown(object sender, AxXtremePropertyGrid._DPropertyGridEvents_InplaceButtonDownEvent e) { System.Diagnostics.Debug.WriteLine("Inplace button down. Item.Caption = " + e.button.Item.Caption); if (e.button.Item.Id == ITEM_DIRECTORY) { string strPath = Shell.BrowseForFolder("Directories"); if (strPath != "") { e.button.Item.Value = strPath; } } if (e.button.Item.Id == ITEM_MENUBUTTON) { int l, t, r, b; e.button.Item.GetRect(out l, out t, out r, out b); mnuSample.Show(this, CurrentMousePosition); } } |
|
madness
Newbie Joined: 08 June 2010 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Thank you. I will give this a try.
|
|
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 |