Frequently Asked Component Specific Questions
Chronological |
By Author: |
Displaying items 1 to 15 of 34, page 1 of 3
<< previous next >>


TMS Advanced Charts: Add custom X-axis values via an event (Jan 29, 2009)To override the standard X-axis values drawn by TAdvChartView an event OnXAxisDrawValue event is available for each serie. To add an event handler for OnXAxisDrawValue, declare a procedure and assign it to the serie.OnXAxisDrawValue event like in the code snippet below:
AdvChartView.Panes[0].Series[0].OnXAxisDrawValue := XAxisDrawValue; procedure TForm.XAxisDrawValue(Sender: TObject; Serie: TChartSerie; Canvas: TCanvas; ARect: TRect; ValueIndex, XMarker: integer; Top: Boolean; var defaultdraw: Boolean); begin //Insert Code here end;
The technique illustrated with following sample. Some points were added in a serie and for each odd value on the X-Axis we want to display a Car brand in the X-axis:
procedure TForm.XAxisDrawValue(Sender: TObject; Serie: TChartSerie;
Canvas: TCanvas; ARect: TRect; ValueIndex, XMarker: integer; Top: Boolean;
var defaultdraw: Boolean);
const
lst: array[0..4] of String = ('Audi', 'BMW', 'Mercedes', 'Bugatti', 'Porsche');
var
s: String;
th, tw: integer;
begin
if Odd(ValueIndex) then
begin
Canvas.Font.Size := 12;
s := lst[Random(Length(lst))];
th := Canvas.TextHeight(s);
tw := Canvas.TextWidth(s);
Canvas.TextOut(Xmarker - (tw div 2), ARect.Top + th, s);
end;
end;Pieter Scheldeman (Jan 29, 2009)


TMS Advanced Charts: Updating Chart at runtime (Feb 27, 2009)When updating the chart component at runtime it is important to "tell" the chart to update itself.
Whenever you change properties, or add/remove points the chart will not be updated.
This is because the chart will be repainted over and over again every time you change a property.
This would cause a slow performance.
To update the chart at runtime, after you change properties, you must use the BeginUpdate / EndUpdate methods.
Sample: Updating a series of points at runtime
procedure TForm1.Button1Click(Sender: TObject);
begin
AdvChartView1.BeginUpdate;
with AdvChartView1.Panes[0].Series[0] do
begin
Points[0].SingleValue := 100;
Points[1].SingleValue := 50;
Points[2].SingleValue := 20;
Points[3].SingleValue := 30;
Points[4].SingleValue := 150;
Points[5].SingleValue := 160;
end;
AdvChartView1.EndUpdate;
end;Pieter Scheldeman (Feb 27, 2009)


TAdvSmoothMegaMenu: Adding Sections and Items (Jun 19, 2009)Adding a root menu with a section and 5 items
with AdvSmoothMegaMenu1.MenuItems.Add do
begin
Caption := 'Hello World !';
with Menu.Sections.Add do
begin
Caption := 'Section 0';
Items.Add.Text := 'Item 1';
Items.Add.Text := 'Item 2';
Items.Add.Text := 'Item 3';
Items.Add.Text := 'Item 4';
Items.Add.Text := 'Item 5';
end;
end; with AdvSmoothMegaMenu1.MenuItems.Add do
begin
Caption := 'Hello World !';
Menu.SectionLayout := slHorizontal;
// Menu.SectionLayout := slVertical;
for I := 0 to 1 do
begin
with Menu.Sections.Add do
begin
Caption := 'Section ' + inttostr(I);
Items.Add.Text := 'Item 1';
Items.Add.Text := 'Item 2';
Items.Add.Text := 'Item 3';
Items.Add.Text := 'Item 4';
Items.Add.Text := 'Item 5';
end;
end;
end; with AdvSmoothMegaMenu1.MenuItems.Add do
begin
Caption := 'Hello World !';
with Menu.Sections.Add do
begin
Caption := 'Section 0';
Items.Add.Text := 'Item 1';
Items.Add.Text := 'Item 2';
Items.Add.Text := 'Item 3';
Items.Add.Text := 'Item 4';
Items.Add.Text := 'Item 5';
Items.Add.ItemType := itBreak;
Items.Add.Text := 'Item 1';
Items.Add.Text := 'Item 2';
Items.Add.Text := 'Item 3';
Items.Add.Text := 'Item 4';
Items.Add.Text := 'Item 5';
end;
end;Pieter Scheldeman (Jun 19, 2009)


TAdvSmoothMegaMenu: Adding and connecting picturecontainer images to section items (Jun 19, 2009)Drop a TGDIPPictureContainer on the form, and add three items, named red, orange, green.
Add an image for each item in the picturecontainer list.
Drop a TAdvSmoothMegaMenu on the form and connect the PictureContainer with the TAdvSmoothMegaMenu component.
Choose the first menu item by selecting the MenuItems collection and starting the TGDIPMenu editor by clicking on the Menu property.
When the menu editor is started, select an section item and change the graphic left or right to the image name you have set in the collection of images.
Pieter Scheldeman (Jun 19, 2009)


TAdvSmoothMegaMenu: Connection a detail item to a top layer item (Jun 19, 2009)Drop a new TAdvSmoothMegaMenu on the form, start the editor of the first root item to edit the sub menu. You will see a default section with 5 items. We will need to make the section width larger to add a top layer. When the section size increases the item width will also increase, so first add an item and set the ItemType to itBreak to split the section in 2 columns.
After the section has been divided, add a new top layer item and place it in the empty column.
Click on an item that needs to display detail information. In the Item detail tab, the correct top layer item and text can be selected to display in the top layer item. There are two important ways that can be used to display the information. You can display the detail text when hovering the item or when the item is selected.
Change the Top layer hover index or top layer selected index to the correct top layer. Multiple items can point to the same top layer.
When setting the detail text property of the item, the result will be:
As you change properties, layout, items, sections and top layer items, the default TAdvSmoothMegaMenu can be completely different after the project is finished. Below is an example that combines the picturecontainer, sections, section items, controls and top layer items.
Pieter Scheldeman (Jun 19, 2009)


TMS Smooth Controls Pack: Update smooth controls faster with BeginUpdate and EndUpdate (Nov 16, 2009)This short article describes the use of BeginUpdate and EndUpdate methods to allow faster updating and repainting.
When creating a smooth listbox or a smooth imagelistbox with 500+ items in code, it tends to be slow when starting the application.
For each item that is added / deleted or updated, the listbox is updated. It is just a matter of milliseconds to update the listbox for one item, but imagine the time that is needed to update 500 items. And these items are drawn with the default layout. With more advanced items the update process can be painfully slow.
Because we cannot predict when the user wants to update the listbox, we have implemented a BeginUpdate and EndUpdate which *blocks* the painting of the listbox until the EndUpdate is called. Then all the calculations and painting is executed once, with all the new information the user has inserted in the items.
Below is a code sample based on the TAdvSmoothListBox component to update all items between a BeginUpdate and EndUpdate.
var
i: integer;
begin
AdvSmoothListBox1.Items.BeginUpdate;
for I := 0 to AdvSmoothListBox1.Items.Count - 1 do
begin
AdvSmoothListBox1.Items[i].Caption := 'Item Updated !';
end;
AdvSmoothListBox1.Items.EndUpdate;Important note !: All BeginUpdate calls must end with an EndUpdate. In other words: The count of BeginUpdate and EndUpdate calls must be equal. When this condition is false, the listbox will not update, and the listbox will not respond to other update calls.
A List of components which currently implement the BeginUpdate and EndUpdate:
- AdvSmoothListBox (AdvSmoothListBox.Items.BeginUpdate / EndUpdate)
- AdvSmoothImageListBox (AdvSmoothImageListBox.Items.BeginUpdate / EndUpdate)
- AdvSmoothDock (AdvSmoothDock.BeginUpdate / EndUpdate)
- AdvSmoothExpanderGroup (AdvSmoothExpanderGroup.BeginUpdate / EndUpdate)
- AdvSmoothSplashScreen (AdvSmoothSplashScreen.BeginUpdate / EndUpdate)
- AdvSmoothTimeLine (AdvSmoothTimeLine.BeginUpdate / EndUpdate)
- AdvSmoothTouchKeyBoard (AdvSmoothTouchKeyBoard.Completion.BeginUpdate / EndUpdate)
Pieter Scheldeman (Nov 16, 2009)


TMS Smooth Controls Pack: Disable internal drag/drop in TAdvSmoothDock (Jan 28, 2010)To disable the internal item drag/drop in the TAdvSmoothDock add the
OnItemStartDrag event and set Allow to false:
procedure TForm1.AdvSmoothDock1ItemStartDrag(Sender: TObject; DragItem: TAdvSmoothDockItem; var Allow: Boolean); begin Allow := false; end;
Pieter Scheldeman (Jan 28, 2010)


TAdvSmoothDock: Disable internal drag/drop in TAdvSmoothDock (Jan 28, 2010)To disable the internal item drag/drop in the TAdvSmoothDock add the
OnItemStartDrag event and set Allow to false:
procedure TForm1.AdvSmoothDock1ItemStartDrag(Sender: TObject; DragItem: TAdvSmoothDockItem; var Allow: Boolean); begin Allow := false; end;
Pieter Scheldeman (Jan 28, 2010)


TAdvSmoothDock: TAdvSmoothDock on the desktop (Feb 12, 2010)AdvSmoothDock on the desktop
The TAdvSmoothDock can also be placed on the desktop with some minor code changes. Download and examine the sample below:
Below is a preview if the demo is running:
Pieter Scheldeman (Feb 12, 2010)


TMS Advanced Charts: XY chart in combination with DateTime X-Axis (May 11, 2010)With the release of the new XY Line and Marker chart, we have added the possibility to add a range of datetimes on specific intervals between the RangeFrom and RangeTo.
We have uploaded a sample for you to investigate:
XY DateTime Demo
Pieter Scheldeman (May 11, 2010)


TMS Advanced Poly List: Is any Microsoft licensing required to use the TMS Poly list controls similar to the Office 2007 ribbon ? (May 12, 2010)TMS Poly list controls can be used for so much more than just the
Office 2010 application menu. They extend these controls and are in
several ways more versatile. Ribbon UI licensing does not apply on
such separate controls.
Pieter Scheldeman (May 12, 2010)


TMS Advanced Charts: Simple XY chart Demo (Jun 8, 2010)This sample demonstrates a simple XY scatter demo, with properties set to
display the X-values below the main X-Axis as well as displaying the points on a specific
(X, Y) point between RangeFrom and RangeTo.
http://www.tmssoftware.net/public/XYScatterDemo.zip
Pieter Scheldeman (Jun 8, 2010)


TMS Advanced Poly List: Update the poly list faster with beginupdate and endupdate (Jun 24, 2010)This short article describes the use of BeginUpdate and EndUpdate methods to allow faster updating and repainting.
When creating a poly list with 500+ items in code, it tends to be slow when starting the application.
For each item that is added / deleted or updated, the list is updated. It is just a matter of milliseconds to update the list for one item, but imagine the time that is needed to update 500 items. And these items are drawn with the default layout. With more advanced items the update process can be painfully slow.
Because we cannot predict when the user wants to update the list, we have implemented a BeginUpdate and EndUpdate which *blocks* the painting of the listbox until the EndUpdate is called. Then all the calculations and painting is executed once, with all the new information the user has inserted in the items.
Below is a code sample based on theTAdvPolyList component to update all items between a BeginUpdate and EndUpdate.
var
i: integer;
begin
AdvPolyList1.BeginUpdate;
for I := 0 to AdvPolyList1.ItemCount - 1 do
begin
AdvPolyList1.Items[i].Height := 50;
end;
AdvPolyList1.EndUpdate;Important note !: All BeginUpdate calls must end with an EndUpdate. In other words: The count of BeginUpdate and EndUpdate calls must be equal. When this condition is false, the listbox will not update, and the list will not respond to other update calls.
Pieter Scheldeman (Jun 24, 2010)


TMS Advanced Charts: Printing GDI+ charts (Jul 23, 2010)Below is a sample to print GDI+ charts:
http://www.tmssoftware.net/public/PrintDemo.zip
The GDI+ charts are a combination of GDI and GDI+. some elements are drawn in GDI and some elements are drawn in GDI+. Therefore printing a GDI+ chart directly on the printer canvas (which has a different DPI) results in elements with incorrect dimensions. The sample shows how a GDI+ chart can be printed on a bitmap, which is then printed on the printer canvas.
Pieter Scheldeman (Jul 23, 2010)


TAdvSmoothCalendarGroup: Selecting and Displaying Disjunct Days (Aug 9, 2010)To Select disjunct dates, just use the procedure SelectDisjunctDates and pass an array of TDateTime:
var d: TDateTime; begin d := Now; AdvSmoothCalendar1.SelectDisjunctDates([d, d+2, d+4]); end;
This will select the current date, the current date + 2 days and the current date + 4 days.
To display the selected dates you can loop through the DisjunctDates array:
var
I: Integer;
d: TDateTime;
begin
for I := 0 to Length(AdvSmoothCalendar1.DisjunctDates) - 1 do
begin
d := AdvSmoothCalendar1.DisjunctDates[i];
outputdebugstring(pchar(datetostr(d)));
end;Pieter Scheldeman (Aug 9, 2010)




