Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 31 to 45 of 508, page 3 of 34
<< previous next >>
Adding an indicator
The TAdvSmoothTimeLine can display indicators with different shapes to mark special points on the timeline or to give extra information.
Example:
with AdvSmoothTimeLine1.TimeLineIndicators.Add do begin Position :=AdvSmoothTimeLine1.Range.RangeFrom + ((AdvSmoothTimeLine1.Range.RangeTo - AdvSmoothTimeLine1.Range.RangeFrom) / AdvSmoothTimeLine1.Range.SubDivisions); Shape := isDiamond; Color := clWhite; ColorTo := clGreen; Hint := 'This is a new Indicator on February'; end;
The indicator is limited to a single position and can be dragged along the timeline to change the position. With the OnIndicatorPositionChanged and OnIndicatorPositionChanging event you can see the current position of the indicator. The indicator dragging can be disabled by setting the Fixed property to true.
Adding an annotation
The annotations are added in the same collection as the indicators, but setting the Annotation string property, adds an text to the annotation that can be positioned on top of the timeline or at the bottom of the timeline. When multiple annotations are added the timeline automatically calculates the best possible position to make sure the annotation does not intersect with another annotation.
Example:
AdvSmoothTimeLine1.TimeLineBar.AnnotationFont.Color := clWhite; with AdvSmoothTimeLine1.TimeLineIndicators.Add do begin Annotation := 'This is an Annotation'; Position := IncSecond(AdvSmoothTimeLine1.Range.RangeFrom, 5); AnnotationColor := clGreen; end;
An annotation can also contain an image. Add an ImageList container and set the ImageListIndex property to the correct image.
Adding a section
An indicator is limited to one position property while the Section can be stretched over a timezone between a starttime and endtime.
Example:
with AdvSmoothTimeLine1.TimeLineSections.Add do begin StartTime := AdvSmoothTimeLine1.Range.RangeFrom + ((AdvSmoothTimeLine1.Range.RangeTo - AdvSmoothTimeLine1.Range.RangeFrom) / AdvSmoothTimeLine1.Range.SubDivisions) * 3; EndTime := AdvSmoothTimeLine1.Range.RangeFrom + ((AdvSmoothTimeLine1.Range.RangeTo - AdvSmoothTimeLine1.Range.RangeFrom) / AdvSmoothTimeLine1.Range.SubDivisions) * 5; Hint := 'This is a new Section between March and June'; end;
The Section hints can be customized with the HintFill property on Section level. There are also DefaultHintfill, DefaultIndicator and DefaultSectionFill to apply when a new indicator or section is added.
Changing the divisions and subdivisions
By default the timeline has a FixedNumber division type. This division type can be changed to hours, minutes, seconds, months, years, days and milliseconds. When choosing the FixedNumber division type the timeline will always be divided in the amount of divisions and/or subdivisions. When the division type is based on a different type the values and tickmarks will be calculated based on the divisioncount and the division type.
Sample:
RangeFrom := 1/1/2000
RangeTo := 1/1/2100
DivisionType := dtYear
Divisions := 10
SubDivisions := 1
Result:
Creating a TAdvSmoothMessageDialog
Example:
var md: TAdvSmoothMessagedialog; begin md := TAdvSmoothMessageDialog.Create(Self); md.Caption := 'Game over !'; with md.Buttons.Add do begin Caption := 'Yes'; ButtonResult := mrYes; end; with md.Buttons.Add do begin Caption := 'No'; ButtonResult := mrNo; end; md.HTMLText.Text := 'Do you want to start a new game?'; md.HTMLText.Location := hlCenterCenter; md.SetComponentStyle(tsOffice2007Silver); md.Execute;
Showing a default message dialog
The TAdvSmoothMessageDialog supports functions to quickly show a default message dialog. By doing a find & replace in existing applications of ShowMessage to ShowSmoothMessage and MessageDlg to SmoothMessageDlg, you can quickly change an application to use the new dialogs. Below are the functions signatures that can be used:
procedure ShowSmoothMessage(const Msg: string; AStyle: TTMSStyle = tsOffice2007Luna); function SmoothMessageDlg(const Title, Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; AStyle: TTMSStyle = tsOffice2007Luna): Integer; overload; function SmoothMessageDlg(const Title, Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; DefaultButton: TMsgDlgBtn; AStyle: TTMSStyle = tsOffice2007Luna): Integer; overload; function SmoothMessageDlgPos(const Title, Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer; AStyle: TTMSStyle = tsOffice2007Luna): Integer; overload; function SmoothMessageDlgPos(const Title, Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer; DefaultButton: TMsgDlgBtn; AStyle: TTMSStyle = tsOffice2007Luna): Integer; overload;
Using the Execute & ExecuteDialog function
The TAdvSmoothMessageDialog has an Execute and ExecuteDialog function. The ExecuteDialog function returns a TModalResult. The Execute function returns a Boolean and this Boolean is only true when the ModalResult is mrOk or mrYes. When adding buttons and using the Execute function, make sure that there is a button with the ButtonResult mrOk or mrYes.
AdvSmoothMessageDialog1.Buttons.Clear; AdvSmoothMessageDialog1.Position := poScreenCenter; with AdvSmoothMessageDialog1.Buttons.Add do begin ButtonResult := mrOk; Caption := 'Ok'; end; with AdvSmoothMessageDialog1.Buttons.Add do begin ButtonResult := mrCancel; Caption := 'Cancel'; end; if AdvSmoothMessageDialog1.Execute then Label1.Caption := 'Ok Button clicked';
Changing the appearance of the message dialog
The message dialog can be fully customized for its 4 different elements:
- Buttons: The buttons have a separate appearance and can be formatted with a color, and opacity property. When a picture is needed to make the button more attractive use the picture and pictureposition property. The buttons can also be vertical or horizontal stacked depending on the type of message dialog needed.
The ButtonAreaFill property is used to fill the area of the buttons.
- Caption: The caption has a separate fill that is fully customizable. With the CaptionFont and CaptionPosition properties the caption text can be formatted.
- HTML: The HTML text has no separate Fill and is drawn directly on the message dialog.The HTML text can be customized in a separate dialog. With the OnAnchorClick event you can call a ShellExecute to open the URL.
procedure TForm1.AdvSmoothMessageDialog1AnchorClick(Sender: TObject; Anchor: string); begin ShellExecute(0,'open',pchar(Anchor),nil,nil,SW_NORMAL); end;
Adding a progressbar
The Message dialog supports a progressbar, that can be positioned inside the messagedialog with the ProgressBarPosition property.
The ProgressBarValue ProgressBarMaximum and ProgressBarMinimum properties determine the Range and position of the ProgressBar.
The ProgressBarAppearance can be fully customized to add text, change the look and feel of the progressbar.
<
Using overlay textures
The AdvSmoothMessageDialog has a margin property to indent the messagedialog drawing. This opens the possibility to add overlay textures, textures that visually go out the draw area. Below is a sample of a default messagedialog with a margin and a texture. The captionfill.Picture is loaded with a PNG image and the picture position and size are customized.
AdvSmoothMessageDialog1.Caption := 'Message Dialog with texture'; AdvSmoothMessageDialog1.Position := poScreenCenter; AdvSmoothMessageDialog1.Execute;
Adding items & extra properties in code
In design time the AdvSmoothListBox has some items by default. Below you can see how to add items in code and in some cases extra properties can be set to change the item appearance.
procedure TForm1.AddPoints; var i: integer; begin //Adds 20 items for i := 0 to 20 do begin with AdvSmoothListBox.Items.Add do begin Enabled := True; //If enabled false then the item will be drawn in disabled fill GraphicLeftType := gtCheckBox Checked := False; //the item will be checked if the type is a checkbox or a radiobutton Caption := ‘Item ’+ inttostr(i); Info := ‘Info ’+ inttostr(i); Notes := ‘Notes ’ + link Splitter := false; //if splitter is true a empty space will be drawn between 2 items DetailControl := Panel1 //depending on the action chosen to visualize the details the detailcontrol will be shown. Level := 1; //Set the level property to allow expanding and collapsing item groups Indent := 30; //Set the indent property to visually indent the item. end; end; end;
Visual organisation of TAdvSmoothListBox
TMS Advanced Smooth ListBox is a component with the following main visual elements:
1) The header can contain information on how the items are organised or which types of items are in the ListBox. For example: “Contact list”. The header can also contain HTML text and images. The header can be visible or not.
2) In case you define the ListBox as a “Contact list” you can set the item sections visible. This allows you to group the items under the section of the same category. The categories which are currently available are alphabetical and numeric.
3) These are the ListBox items which can be fully customized in many ways: HTML text, images graphics, controls …
4) When you want to search an item you can easily navigate to the first item with the letter you clicked at the lookup bar.
5) The optional footer is identical to the header and allows displaying extra information at the bottom of the list, such as summary information for example like “Number of contacts: …”
Customizing ListBox items
The ListBox item can be customized in many ways: various text elements, graphics, and controls. Below is an overview of the important visual elements of the ListBox item.
1) The item can contain a graphic on the left and the right side. The type of graphic can be changed with the property GraphicLeftType or GraphicRightType.
The types you can choose from are listed below. In case of gtDetailImage the image can be clicked to enter the details. When choosing gtCommonImage or gtCommonDetailImage, the function is the same as the gtImage or gtDetailImage type, but only uses a global image defined on TAdvSmoothListBox level that can be used for all items.
Supported types:
- gtButton, gtSmoothButton: button is displayed on the item
- gtCheckBox: checkbox is displayed on the item
- gtRadioButton: radiobutton is displayed on the item
- gtImage: image is displayed on the item
- gtDetailImage: image that shows detail control on click is displayed
- gtCommonImage: common listbox image is displayed on the item
- gtCommonDetailImage: common listbox detail image is displayed on the item
- gtNone: nothing is displayed
2) The caption text of the item. The caption can optionally be clicked and triggers the OnItemCaptionClick event.
3) The HTML notes text of the item can be formatted with a design time HTML editor. The HTML can contain images listed in a TGDIPPictureContainer or a TImageList. When clicking on an anchor of the HTML text the event OnAnchorClick is called.
4) The info of the item can contain extra information of the info and when clicked will trigger the OnItemInfoClick event.
Grouping items
With the AdvSmoothListBox it is possible to group the items and expand or collapse them with a single click. The level property on an item allows you to define the different groups to collapse or expand. The indent property can be used to visually create a “node” that is indented to the right. An item has a public expanded property. With this property you can expand or collapse items with a level that is higher than the current item.
Sample:
with AdvSmoothListBox5.Items.Add do begin Caption := 'Mercedes'; GraphicLeftType := gtSmoothButton; ButtonCaption := '-'; ButtonBevelColor := clBlack; ButtonColor := clGreen; GraphicLeftWidth := 25; end; with AdvSmoothListBox5.Items.Add do begin Level := 1; Caption := 'Mercedes SLK Roadster'; Indent := 30; end; with AdvSmoothListBox5.Items.Add do begin Level := 1; Caption := 'Mercedes SLR Coupé'; Indent := 30; end; with AdvSmoothListBox5.Items.Add do begin Level := 1; Caption := 'Mercedes GLK 4x4'; Indent := 30; end; with AdvSmoothListBox5.Items.Add do begin Caption := 'BMW'; GraphicLeftType := gtSmoothButton; ButtonCaption := '-'; ButtonBevelColor := clBlack; ButtonColor := clGreen; GraphicLeftWidth := 25; end; with AdvSmoothListBox5.Items.Add do begin Level := 1; Caption := 'BMW M3'; Indent := 30; end; with AdvSmoothListBox5.Items.Add do begin Level := 1; Caption := 'BMW Z4'; Indent := 30; end; with AdvSmoothListBox5.Items.Add do begin Level := 1; Caption := 'BMW X5'; Indent := 30; end; with AdvSmoothListBox5.Items.Add do begin Caption := 'Land Rover'; GraphicLeftType := gtSmoothButton; ButtonCaption := '-'; ButtonBevelColor := clBlack; ButtonColor := clGreen; GraphicLeftWidth := 25; end; with AdvSmoothListBox5.Items.Add do begin Level := 1; Caption := 'Land Rover Defender 90'; Indent := 30; end; with AdvSmoothListBox5.Items.Add do begin Level := 1; Caption := 'Land Rover Series III'; Indent := 30; end; with AdvSmoothListBox5.Items.Add do begin Level := 1; Caption := 'Range Rover Sport V8'; Indent := 30; end;
Result:
Visual organisation of TAdvSmoothImageListBox
TMS TAdvSmoothImageListBox is a component with the following main visual elements:
1) The header can contain information on how the items are organised or which types of items are displayed in the ListBox. Appearance of the header can be fully controlled: all characteristics of the fill can be set, text can be positioned in various locations, text can contain HTML formatting tags, additional images can be set. The header can also be set invisible.
2) The optional footer is identical to the header and allows displaying extra information at the bottom of the list, such as summary information for example like “Number of images: …”
3) This is an example of a top layer item which can be fully customized and can be placed on various positions on top of the listbox. A top layer item can also display HTML text. The fill of each top layer item can be fully customized including its opacity.
4) An item added to the collection can be either an item or a splitter. The splitter can contain text and also a collaps/expand button. With the expand/collaps buttons, all items between two splitters can be made visible or invisible.
5) An item added to the collection can contain an image and HTML text. Different appearance settings can be set to control the position of the image and text in the item. These settings can be found under TAdvSmoothImageListBox.ItemAppearance