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; |
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. |
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; |
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:
How to achieve that the selected row in the grid is only indicated by a selection rectangle and the regular cell background color is preserved for the selected row? |
This can be done with following code applied to a default TAdvStringGrid: procedure TForm5.AdvStringGrid1GetCellColor(Sender: TObject; ARow, ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont); begin if arow > 0 then begin case acol of 1: ABrush.Color := clYellow; 2: ABrush.Color := clGreen; 3: ABrush.Color := clRed; else ABrush.Color := clWhite; end; end; end; procedure TForm5.FormCreate(Sender: TObject); begin advstringgrid1.SelectionRectangle := true; advstringgrid1.Options := advstringgrid1.Options + [goRowSelect]; advstringgrid1.SelectionColorMixer := true; advstringgrid1.SelectionColorMixerFactor := 0; end; |
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; |
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 |
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; |
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; |
You can use the OnGetCellType event to specify the column type for a specific row, column or cell. Example: procedure TIWForm1.TIWAdvWebGrid1GetCellType(Sender: TObject; RowIndex, ColumnIndex: Integer; var AColumnType: TTIWColumnType; var Editor: TTIWColumnEditor; var DynEditor: TTIWDynEditType); begin if (ColumnIndex = 1) and (RowIndex = 1) then AColumnType := ctButton; end; |
As always, we thank all users for the numerous inputs, feedback, comments and suggestions. This is an invaluable help to steer our developments here at TMS software. We continue to look forward to all your further communications to direct our team to provide you better tools and components for your needs.
Kind regards,
TMS software team
Email:
info@tmssoftware.com
Web: http://www.tmssoftware.com
Support, FAQ & Manuals: http://www.tmssoftware.com/site/support.asp