Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 391 to 405 of 508, page 27 of 34
<< previous next >>
TAdvOfficePager
Indicate progress of a process on the tab of a TAdvOfficePager
Indicate progress of a process on the tab of a TAdvOfficePager
This option saves space and indicates useful progress information to users when different processes are handled in different tabs. To enable progress on the tab, this can be configured via TAdvOfficePage.Progress:
procedure TForm1.FormCreate(Sender: TObject); begin AdvOfficePager11.Caption := ''Tab with progress''; AdvOfficePager11.Progress.Visible := true; AdvOfficePager11.Progress.Position := 25; // set this to true to make tab also visible when it is not selected: AdvOfficePager1.ShowNonSelectedTabs := true; end;
The progress class has further properties to customize the progressbar colors / background colors.
TAdvPanel
Using a custom TAdvPanel class to insert panels in a TAdvPanelGroup
Using a custom TAdvPanel class to insert panels in a TAdvPanelGroup
By default, calling AdvPanelGroup.AddPanel will create and insert an instance of TCustomAdvPanel in the AdvPanelGroup. You can override this by setting the class to create via AdvPanelGroup1.PanelClass. Note that the class to be created must descend from TCustomAdvPanel.
Example:
This is a custom created TAdvPanel class that automatically adds a button the panel:
type TMyCustomPanel = class(TAdvPanel) private FButton: TButton; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; property Button: TButton read FButton; end; { TMyCustomPanel } constructor TMyCustomPanel.Create(AOwner: TComponent); begin inherited Create(AOwner); FButton := TButton.Create(Self); FButton.Parent := Self; FButton.Top := 30; FButton.Left := 20; FButton.Caption := ''OK''; end; destructor TMyCustomPanel.Destroy; begin FButton.Free; inherited; end;
begin AdvPanelGroup1.PanelClass := TMyCustomPanel; AdvPanelGroup1.AddPanel; end;
TMS FMX UI Pack
TTMSFMXTileList: How to change the default color of the badge
TTMSFMXTileList: How to change the default color of the badge
You can change the default color with the following code:
procedure TForm1.TMSFMXTileList1CustomizeTileBadge(Sender: TObject; ATile: TTMSFMXTile; ATileBadge: TControl); var r: TControl; begin (ATile.ShapeBadge as TTMSFMXBadge).NeedStyleLookup; (ATile.ShapeBadge as TTMSFMXBadge).ApplyStyleLookup; r := (ATile.ShapeBadge as TTMSFMXBadge).GetContent; if Assigned(r) then begin (r as TRoundRect).Fill.Color := claLimegreen; (r as TRoundRect).Fill.Kind := TBrushKind.Solid; (r as TRoundRect).Stroke.Color := claGreen; end; end;
TMS FMX UI Pack
TTMSFMXPlanner: How to show a bitmap at selection of a timeslot
TTMSFMXPlanner: How to show a bitmap at selection of a timeslot
You can add a bitmap at selection with the following code:
procedure TForm1.FormCreate(Sender: TObject); begin TMSFMXPlanner1.SelectionAppearance.Fill.Kind := TBrushKind.None; end; procedure TForm1.TMSFMXPlanner1AfterDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRectF; ACol, ARow: Integer; AStartTime, AEndTime: TDateTime; APosition: Integer; AKind: TTMSFMXPlannerCacheItemKind); var bmp: TBitmap; begin if (ARow = TMSFMXPlanner1.Selection.EndCell.Row) and (ACol = TMSFMXPlanner1.Selection.EndCell.Col) then begin bmp := TBitmap.Create; bmp.LoadFromFile(''MyImage''); try ACanvas.DrawBitmap(bmp, RectF(0, 0, bmp.Width, bmp.Height), RectF(ARect.Right - bmp.Width, ARect.Top + (ARect.Height - bmp.Height) / 2, ARect.Right, ARect.Top + (ARect.Height - bmp.Height) / 2 + bmp.Height), 1); finally bmp.Free; end; end; end; procedure TForm1.TMSFMXPlanner1BeforeDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRectF; ACol, ARow: Integer; AStartTime, AEndTime: TDateTime; APosition: Integer; AKind: TTMSFMXPlannerCacheItemKind; var AAllow, ADefaultDraw: Boolean); begin if (ARow >= TMSFMXPlanner1.Selection.StartCell.Row) and (ARow <= TMSFMXPlanner1.Selection.EndCell.Row) and (ACol >= TMSFMXPlanner1.Selection.StartCell.Col) and (Acol <= TMSFMXPlanner1.Selection.EndCell.Col) then begin ACanvas.Fill.Assign(TMSFMXPlanner1.SelectionAppearance.Fill); ACanvas.Fill.Kind := TBrushKind.Solid; end; end;
TMS FMX UI Pack
TTMSFMXGrid: How to get access to a ProgressBar object inside a cell
TTMSFMXGrid: How to get access to a ProgressBar object inside a cell
You can access each cell and its properties in the OnGetCellProperties event:
procedure TForm1.TMSFMXGrid1GetCellProperties(Sender: TObject; ACol, ARow: Integer; Cell: TFmxObject); var p: TTMSFMXProgressBar; begin if Cell is TTMSFMXProgressGridCell then begin p := (Cell as TTMSFMXProgressGridCell).ProgressBar; p.ShowText := False; end; end;
TMS IntraWeb iPhone controls pack
Avoid access to non-visual IWEdit controls
Avoid access to non-visual IWEdit controls
When using 2 IWRegion controls that each contain an IWEdit control in combination with a TIWIPhonePageTransition control. If the user presses the "< " ">" keys to move to the next or previous field, they can reach a field on a region that is not being displayed. The display will even show portions of both regions simultaneously.
Solution:
You can set the Enabled property of the IWEdit controls on the non-visual IWRegion controls to false. Then set it to true again when TransitionToNext or TransitionToPrevious is called.
Example:
procedure TIWForm8.TIWIPhoneHeader1AsyncRightButtonClick(Sender: TObject; EventParams: TStringList); begin IWEdit1.Enabled := false; IWEdit2.Enabled := true; TIWIPhonePageTransition1.TransitionToNext; end; procedure TIWForm8.TIWIPhoneHeader2AsyncLeftButtonClick(Sender: TObject; EventParams: TStringList); begin IWEdit1.Enabled := true; IWEdit2.Enabled := False; TIWIPhonePageTransition1.TransitionToPrevious; end;
When trying to install the registered version of the TMS TAdvStringGrid filters I get an error similar to: TMS FlexCel Studio...is not installed
Make sure you run the TMS Grid Filters installers from the same Windows user account as the one with which you installed TMS Component Pack & TMS Flexcel. The TMS Grid Filters installer searches for TMS Component Pack & TMS Flexcel installs in the registry for the current Windows user.
TAdvRichEditor
Customizing the popup menu
Customizing the popup menu
From the OnContextPopup event that is triggered before the popup menu is displayed, it is easy to customize it, for example to dynamically translate or add items.
This example performs a dynamic translation:
procedure TForm4.AdvRichEditor1ContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean); begin if AppLanguage = alGerman then begin AdvRichEditor1.PopupMenu.Items[0].Caption := ''Löschen''; AdvRichEditor1.PopupMenu.Items[2].Caption := ''Ausschneiden''; AdvRichEditor1.PopupMenu.Items[3].Caption := ''Kopieren''; AdvRichEditor1.PopupMenu.Items[4].Caption := ''Einfügen''; AdvRichEditor1.PopupMenu.Items[6].Caption := ''Ausrichten''; AdvRichEditor1.PopupMenu.Items[6].Items[0].Caption := ''Links''; AdvRichEditor1.PopupMenu.Items[6].Items[1].Caption := ''Zentrum''; AdvRichEditor1.PopupMenu.Items[6].Items[2].Caption := ''Rechts''; end; end;
TMS VCL Cloud Pack
How to store OAuth token in a database table instead of an ini file
How to store OAuth token in a database table instead of an ini file
Make a dataset with following string fields:
ACCESS_TOKEN
AUTH_TOKEN
ACCESS_TOKEN_SECRET
AUTH_TOKEN_SECRET
REFRESH_TOKEN
EXTRA_DATA
And set
CloudService.PersistTokens.DataSource = yourdatasource; CloudService.PersistTokens.Location = plDatabase;
Then call:
CloudService.LoadTokens CloudService.SaveTokens
to read and write to the dataset.
TAdvAlertWindow
How to set the position of the TAdvAlertwindow
How to set the position of the TAdvAlertwindow
You can do this by using AdvAlertwindow.PopupLeft, AdvAlertwindow.PopupTop and set AdvAlertWindow.WindowPosition := wpPreset;
Sample code:
procedure TForm4.Button1Click(Sender: TObject); begin advalertwindow1.PopupLeft := 20; advalertwindow1.PopupTop := 20; AdvAlertWindow1.AlertMessages.Add.Text.Text := ''Hello world''; AdvAlertWindow1.WindowPosition := wpPreset; AdvAlertWindow1.Show; end;
TAdvTreeView
How to change the images for the check boxes and radio buttons
How to change the images for the check boxes and radio buttons
You can change the default drawing by implementing the OnBeforeDrawNodeCheck and then set the allow parameter to False. The default checkbox drawing will be disable, and then you can manually draw a different image, or graphic with the ACanvas parameter, as demonstrated in the sample below:
procedure TForm1.AdvCheckedTreeView1BeforeDrawNodeCheck(Sender: TObject; ACanvas: TCanvas; ARect: TRectF; AColumn: Integer; ANode: TAdvTreeViewVirtualNode; var AAllow: Boolean); begin AAllow := False; if ANode.Node.Checked[0] then // draw checked checkbox else // draw unchecked checkbox end;
TAdvStringGrid
Customizing the inplace editor for fixed cells in TAdvStringGrid
Customizing the inplace editor for fixed cells in TAdvStringGrid
In fixed cells, it is possible to define an inplace editor for fixed cells with grid.MouseActions.FixedColsEdit / grid.MouseActions.FixedColsEditor. It is possible to further customize this inplace editor or assign extra event handlers to it via grid.FixedEdit and grid.FixedComboBox that provide access to these control instances.
Example:
This sets the background color for the fixed cell regular editor:
TEdit(AdvStringgrid1.FixedEdit).Color := clRed;
TComboBox(AdvStringGrid.FixedComboBox).OnClick := MyHandler;
TMS Advanced Poly List
Drag and Drop over TCustomItem
Drag and Drop over TCustomItem
Drag & Drop needs to be implemented manually, below is code that inserts or adds an item based on TCustomItem. The item also be a custom class that inherits from TCustomItem. The code below is drag & drop code based on 2 TAdvPolyList instances, where the item to be dropped is obtained from the DropItem function. But the Source can come from another component as well.
procedure TForm1.AdvPolyList1DragDrop(Sender, Source: TObject; X, Y: Integer); var it, itdrop: TCustomItem; begin it := (Source as TAdvPolyList).DropItem; itdrop := AdvPolyList1.List.ItemAtXY(X, Y); if Assigned(itdrop) then AdvPolyList1.InsertItem(itdrop.Index, TCustomItemClass(it.ClassType)).Assign(it) else AdvPolyList1.AddItem(TCustomItemClass(it.ClassType)).Assign(it); end; procedure TForm1.AdvPolyList1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); begin Accept := Source is TAdvPolyList; end;
TAdvOfficePager
How to automatically redock the tab if the user clicks the undocked tab's 'Close' button
How to automatically redock the tab if the user clicks the undocked tab's 'Close' button
You’d need to attach an event handler for the closing of the page when it is floating. You can do this from the OnTabUnDock event where you attach an event handler to the floating form OnClose event.
Example:
TForm1 = class(TForm) public { Public declarations } procedure CloseHandler(Sender: TObject; var Action: TCloseAction); end; procedure TForm1.AdvOfficePager1TabUnDock(Sender: TObject; APage: TAdvOfficePage); begin APage.GetFloatingWindow.OnClose := CloseHandler; end; procedure TForm1.CloseHandler(Sender: TObject; var Action: TCloseAction); begin // floating form closing here end;
TMS VCL WebGMaps
How to get the address at right click on the map and put a marker on this address
How to get the address at right click on the map and put a marker on this address
You can use the OnMapClick event to catch a mouse click on the map. Then use the TWebGMapsReverseGeocoding component to retrieve the address based on the Latitude and Longitude coordinates and add a marker with the Markers.Add() call.
Example:
procedure TForm8.WebGMaps1MapClick(Sender: TObject; Latitude, Longitude: Double; X, Y: Integer; Button: TMouseButton); begin WebGMapsReverseGeocoding1.Latitude := Latitude; WebGMapsReverseGeocoding1.Longitude := Longitude; if WebGMapsReverseGeocoding1.LaunchReverseGeocoding = erOk then WebGMaps1.Markers.Add(Latitude, Longitude, WebGMapsReverseGeocoding1.ResultAddress.FormattedAddress); end;