Type | Description | |||
Item as HITEM | A long expression that indicates the the handle of the item where the bar is removed. | |||
Key as Variant | A String expression that indicates the key of the bar being accessed. If missing, the Key parameter is empty. If the Item has only a single Bar you may not use the Key parameter, else an unique key should be used to allow multiple bars inside the item. The Key may include a pattern with wild characters as *,?,# or [], if the Key starts with "<" and ends on ">" aka "<K*>" which indicates all bars with the key K or starts on K. The pattern may include a space which divides multiple patterns for matching. For instance "<A* *K>" indicates all keys that start on A and all keys that end on K. | |||
Property as ItemBarPropertyEnum | An ItemBarPropertyEnum expression that indicates the property being accessed | |||
Variant | A Variant expression that indicates the property's value. |
Based on the values of the Item and Key parameters the ItemBar property changes a property for none, one or multiple bars as follows:
The pattern may include the space character which indicates multiple patterns to be used when matching. For instance "A* *K" indicates all keys that starts on A and all keys that ends on K. If not using a pattern, the ItemBar changes the property for specified key in all items if 0 is used for Item, or single Item if a valid handle is used on the Item parameter.
Here's few samples of using the set ItemBar property:
- ItemBar(Item,"K1",Property) = Value changes the Property of the bar K1 from the specified Item.
- ItemBar(0,"K1",Property) = Value changes the Property of the bar K1 from the entire chart.
- ItemBar(0,"<A* K*>",Property) = Value changes the Property of all bars from the chart with the Key A or K or starts with A or K.
- ItemBar(0,"<*K>",Property) = Value changes the Property of all bars from the chart with the Key K or ends on K.
- ItemBar(Item,"<K*>",Property) = Value changes the Property of all bars from the specified Item with the Key K or starts on K.
- ItemBar(Item,"<K??>",Property) = Value changes the Property of all bars from the specified Item with the Key of 3 characters and starts with K.
Currently, the single read-only property that supports pattern for the Key parameter is exBarsCount, which counts the bars as follows:
The pattern may include the space character which indicates multiple patterns to be used when matching. For instance "A* *K" indicates all keys that start on A and all keys that end on K.
Here's few samples of using the get ItemBar(exBarsCount) property:
- ItemBar(Item,"K1",exBarsCount) gets the count of the bar K1 from the specified Item. This could be 0, if K1 is not found or 1, if the K1 is found on the Item, as an item could hold a single bar with the same Key.
- ItemBar(0,"K1",exBarsCount) counts all bars K1 from the entire chart.
- ItemBar(Item,"<*>",exBarsCount) counts all bars in the specified item.
- ItemBar(Item,"",exBarsCount) is equivalent with ItemBar(Item,"<*>",exBarsCount).
- ItemBar(0,"<*>",exBarsCount) counts all bars from the entire chart.
- ItemBar(0,"",exBarsCount) is equivalent with ItemBar(0,"<*>",exBarsCount).
- ItemBar(0,"<A* K*>",exBarsCount) gets the count of all bars from the chart with the Key A or K or starts with A or K.
- ItemBar(0,"<*K>",exBarsCount) gets the number of bars from the chart with the Key K or ends on K.
- ItemBar(Item,"<K*>",exBarsCount) counts all bars from the specified Item with the Key K or starts on K.
- ItemBar(Item,"<K??>",exBarsCount) counts all bars from the specified Item with the Key of 3 characters and starts with K.
Use the AddBar property to add new bars to the item. Use the FirstVisibleDate property to specify the first visible date in the chart area. Use the RemoveBar method to remove a bar from an item. Use the ClearBars method to remove all bars in the item. Use the Refresh method to refresh the chart.
The /NET Assembly version defines get/set shortcut properties as follow ( they start with get_ or set_ keywords ):
So instead using the get_ItemBar or set_ItemBar properties you can use these functions.
For instance, the following sample changes the bar's color:
With Exgantt1.Items .set_BarColor(.FocusItem, .get_FirstItemBar(.FocusItem), Color.Red) End With
The following VB sample changes the end date for the bar in the first visible item ( in this sample we consider that AddBar method was used with the Key parameter as being empty ) :
With Gantt1.Items .ItemBar(.FirstVisibleItem, "", exBarEnd) = "6/19/2005" End With
The following C++ sample changes the end date for the bar in the first visible item:
CItems items = m_gantt.GetItems(); items.SetItemBar( items.GetFirstVisibleItem(), COleVariant(""), 2 /*exBarEnd*/, COleVariant("6/19/2005") );
The following VB.NET sample changes the end date for the bar in the first visible item:
With AxGantt1.Items .ItemBar(.FirstVisibleItem, "", EXGANTTLib.ItemBarPropertyEnum.exBarEnd) = "6/19/2005" End With
The following C# sample changes the end date for the bar in the first visible item:
axGantt1.Items.set_ItemBar(axGantt1.Items.FirstVisibleItem, "", EXGANTTLib.ItemBarPropertyEnum.exBarEnd, "6/19/2005");
The following VFP sample changes the end date for the bar in the first visible item:
with thisform.Gantt1.Items .DefaultItem = .FirstVisibleItem thisform.Gantt1.Template = "Items.ItemBar(0,`" + _key + "`,2 ) = `20/07/2005`" endwith
where the _key is the key of the bar being resized.
The VFP sample uses the Template property in order to execute the ItemBar property, else some version of VFP could fire "Function argument, value, type, or count is invalid". The sample builds the script:
Items.ItemBar(0,_key,2) = `20/07/2005`
This way the ItemBar property for the default item is invoked