Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - Adding button
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Adding button

 Post Reply Post Reply
Author
Message
madness View Drop Down
Newbie
Newbie
Avatar

Joined: 08 June 2010
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote madness Quote  Post ReplyReply Direct Link To This Post Topic: Adding button
    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 = False

Item.EditStyle = PropertyItemEditStyle.EditStyleLeft

Item.Flags = PropertyItemFlags.ItemHasEdit Or PropertyItemFlags.ItemHasExpandButton

Item.Id = 9

Dim Button As XtremePropertyGrid.PropertyGridInplaceButton

Button = Item.AddInplaceButton(1)

Button.Caption = "Test Button"

Button.Enabled = True

 

Thanks,
Madness
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2010 at 3:56pm
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);
            }
        }

Back to Top
madness View Drop Down
Newbie
Newbie
Avatar

Joined: 08 June 2010
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote madness Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2010 at 4:44pm
Thank you.  I will give this a try.
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.156 seconds.