Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 16 to 30 of 508, page 2 of 34
<< previous next >>
TDBAdvGrid
Slow loading date into TDBAdvGrid
Slow loading date into TDBAdvGrid
Some dataset implementations have a slow MoveBy operation that causes in turn that TDBAdvGrid is slow. A solution for this is to use a SQL 'SELECT COUNT' operation to supply the number of rows in the dataset to TDBAdvGrid via the event OnGetRecordCount.
In this code snippet, OnGetRecordCount is implemented as:
procedure TForm1.DBAdvGrid1GetRecordCount(Sender: TObject; var Count: Integer); begin Query2.SQL.Text := 'select Count(*) from Country.db'; Query2.Active := True; Count := Query2.Fields[0].AsInteger; Query2.Active := False; end;
TAdvSmoothTouchKeyboard
How to set the state of CAPSLOCK programmatically to down
How to set the state of CAPSLOCK programmatically to down
Programmatically this can be done
for KeyboardType ktqwerty with:
AdvSmoothTouchKeyBoard1.PostKey(VK_CAPITAL, [], true, 29);
AdvSmoothTouchKeyBoard1.PostKey(VK_CAPITAL, [], true, 28);
TAdvMemo
How to add Emoticons programatically
How to add Emoticons programatically
Easiest way to extend / modify this is to start from AdvMes.pas. You can see the override of the method DrawKeyword in the TAdvEmoticonMemoStyler class.
To add/change emoticons, you can add/change emoticons in the resource file advmes.res and change/extend the DrawKeyword function to draw emoticons for different character combinations.
TAdvStringGrid
How to change the size of the find next / previous / highlight buttons in the search bar
How to change the size of the find next / previous / highlight buttons in the search bar
The text of the buttons is exposed via grid.SearchFooter and the recommended way is to use the grid.SearchFooter.* properties. The button width is not exposed, therefore it should be set via grid.SearchPanel.
You can access the buttons in code with:
advstringgrid.SearchPanel.ForwardButton: TButton
advstringgrid.SearchPanel.BackwardButton: Tbutton
Make sure to set this after the searchfooter was created.
TAdvOfficeButtons
How to relate an icon/image to each RadioButton in the TAdvOfficeRadioGroup
How to relate an icon/image to each RadioButton in the TAdvOfficeRadioGroup
You could do this using HTML formatting. You can insert an image via setting a <IMG> tag in the text of the radio group item. See https://www.tmssoftware.com/site/minihtml.asp for the various possibilities for how to specify an image via HTML.
TAdvPageControl
When setting TAdvPageControl.TabBorder3D to True the "X" is not shown on the tab sheets even when ShowClose is True
When setting TAdvPageControl.TabBorder3D to True the "X" is not shown on the tab sheets even when ShowClose is True
It is by design that when TabBorder3D = true, the classic TPageControl look is shown.
As such, in this mode, it cannot show the close buttons as the classic TPageControl does not have this close button capability. If you set TabBorder3D, the TAdvPageControl will look identical on ALL operating systems.
To have a PageControl with close buttons, set TabBorder3D := false or have a look at TAdvOfficePager: https://www.tmssoftware.com/site/aop.asp
TDBPlanner
Can TDBPlanner display multiday events ?
Can TDBPlanner display multiday events ?
TDBPlanner will display the items that span multiple days in the header for each day where the item occurs, just like in Outlook. If you don't see the event , increase Planner.Header.Height
It can indicate in the caption (when you set PlannerItem.CaptionType = ctTime) the start/end time of the item.
TMS Advanced Poly List
Drag & drop items
Drag & drop items
Drag & drop from one list to a second list can be done by implementing 2 events. Allowing an item to be dropped is setting the Accept parameter true. Dropping the item can be done by calling AddDropItem and as parameter the SelectedDragDropItem from the first list.
procedure TForm1.AdvPolyList2DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); begin Accept := Source is TAdvPolyList; end; procedure TForm1.AdvPolyList2DragDrop(Sender, Source: TObject; X, Y: Integer); begin AdvPolyList2.AddDropItem((Source as TAdvPolyList).SelectedDragDropItem); end;
This is also explained at page 34 of the PDF Developers Guide
TMS Advanced Poly List
Using the fill editor at runtime
Using the fill editor at runtime
It is easy to use the fill editor at runtime. To do this, add the unit AdvSmoothFillEditor to the uses list and add following code:
var filldlg :TAdvSmoothFillEditorDialog; begin filldlg := TAdvSmoothFillEditorDialog.Create(self); filldlg.Fill := AdvPolyList1.Fill; filldlg.Execute; end;
This is also explained at page 67 of the PDF Developers Guide
TMS Advanced Poly List
Adding pictures to the TGDIPPictureContainer at runtime
Adding pictures to the TGDIPPictureContainer at runtime
Below is a code snippet that shows how an image is loaded from file and added to the TGDIPPictureContainer:
with GDIPPictureContainer.Items.Add do begin Picture.LoadFromFile('myimage.png’); Name := 'NEW'; end;
with GDIPPictureContainer.Items.Items[0].Free;
TMS Advanced Poly List
Adding / removing items
Adding / removing items
The poly list has a polymorph collection of TCustomItem classes. Each descending class inherits all properties and can also be added to the collection. To access the properties specifically for a descending item, the item must be added to the list and typecasted to the correct class to gain access to the properties.
Adding an item:
with TTextItem(AdvPolyList1.AddItem(TTextItem)) do begin Caption := 'This is a sample'; end;
Inserting an item at a specific position in the collection:
with TTextItem(AdvPolyList1.InsertItem(0, TTextItem)) do begin Caption := 'This is a sample'; end;
Removing an item at a specific position:
AdvPolyList1.RemoveItem(0);
To compile the project, the unit must manually be added to the uses list. In this case the unit is GDIPTextItem which contains the TTextItem class.
The rule for adding the correct unit is:
(T)CustomItem -> (GDIP)CustomItem
Class -> Unit
When you are not sure what unit you must add to compile the project, you can always add the item of choice at designtime, so the unit is automatically added to the uses list.
This is also explained at page 12 of the PDF Developers Guide
TMS Advanced Poly List
Accessing items
Accessing items
Items can be accessed with the “Items” property of the poly list and must be typecasted to the correct class type:
TTextItem(AdvPolyList1.Items[0])
TMS Advanced Poly List
Reordering items
Reordering items
Reordering items is as simple as setting a new index property on the item:
AdvPolyList1.Items[0].Index := 1;
The item will automatically be moved to the new position in the collection. Typecasting is not necessary for properties that are common and available on the base class.
This is also explained at page 12 of the PDF Developers Guide
TAdvSmoothSlideShow
Adding items
Adding items
Items can be added at designtime or at runtime. The slideshow has a built-in function to quickly add images from a folder.
AdvSmoothSlideShow1.AddItemsFromFolder(‘\Sample photos\*.jpg', ikImage);
with AdvSmoothSlideShow1.Items.Add do begin Image.LoadFromFile('image1.jpg'); Location := 'image1.jpg'; Kind := ikImage; Control := Button1; ... end;
TAdvSmoothTimeLine
Changing the start & end time of the timeline
Changing the start & end time of the timeline
To change the start and end time of the timeline, change the Range.RangeFrom and Range.RangeTo properties.
In combination with RangeAppearance.DivisionFormat and RangeAppearance.SubDivisionFormat these properties give full access to every possible time range. The Range.Divisions and Range.SubDivisions properties allow you to specify to number of steps from RangeFrom to RangeTo. For each step a tickmark is drawn.
Example: Years / Months
Settings to display a range from January 2009 to December 2009 with a subdivision for each month:
AdvSmoothTimeLine1.BeginUpdate; AdvSmoothTimeLine1.SetTimeLineRange(EncodeDate(2009, 1, 1), EncodeDate(2009, 12, 31)); AdvSmoothTimeLine1.Range.Divisions := 1; AdvSmoothTimeLine1.Range.SubDivisions := 11; AdvSmoothTimeLine1.RangeAppearance.DivisionFormat := 'mmmm yyyy'; AdvSmoothTimeLine1.RangeAppearance.SubDivisionFormat := 'mmmm'; AdvSmoothTimeLine1.RangeAppearance.DivisionFont.Size := 10; AdvSmoothTimeLine1.RangeAppearance.SubDivisionFont.Size := 7; AdvSmoothTimeLine1.RangeAppearance.DivisionTickMarkSize := 15; AdvSmoothTimeLine1.RangeAppearance.SubDivisionTickMarkSize := 5; AdvSmoothTimeLine1.HorizontalMargin := 50; AdvSmoothTimeLine1.Width := 700; AdvSmoothTimeLine1.EndUpdate;