Frequently Asked Component Specific Questions
Options |
|
Display all FAQ items |
Displaying items 436 to 450 of 888, page 30 of 60
<< previous next >>

TMS Instrumentation WorkShop for FireMonkeyMy First FireMonkey Component
Below is a sample that is useful to understand the design of a new FireMonkey component. These three code snippets will result in your first control which has a backgroundrectangle, a button, an edit, and an additional rectangle.
This component only loads the style file as a layout, and is static. You can click on the button and type in the edit field, but the component has no properties to interact with.
fmx.MyFirstControl.pas
unit fmx.MyFirstControl;
interface
uses
FMX.Types, Types, Classes;
TMyFirstControl = class(TStyledControl)
private
public
constructor Create(AOwner: TComponent); override;
protected
function GetClassName: String; virtual;
function GetClassStyleName: String; virtual;
function GetStyleObject: TControl; override;
function LoadFromResource: TControl;
end;
procedure Register;
implementation
{$R fmx.myfirstcontrol.res}
procedure Register;
begin
RegisterComponents(‘My First FireMonkey Control’, [TMyFirstControl]);
end;
function TMyFirstControl.GetClassName: String;
begin
Result := ClassName;
end;
constructor TMyFirstControl.Create(AOwner: TComponent); override;
begin
inherited;
Width := 209;
Height := 105;
end;
function TMyFirstControl.GetClassStyleName: String;
begin
Result := GetClassName + 'style';
Delete(Result, 1, 1);
end;
function TMyFirstControl.GetStyleObject: TControl;
var
obj: TControl;
begin
obj := inherited GetStyleObject;
if not Assigned(obj) then
begin
// not found in default or custom style book, so create from resource
obj := LoadFromResource;
end;
Result := obj;
end;
function TMyFirstControl.LoadFromResource: TControl;
var
S: TResourceStream;
str: String;
begin
Result := nil;
// create resource class name
str := GetClassStyleName;
if FindRCData(HInstance, str) then
begin
// load from RT_RCDATA resource type
S := TResourceStream.Create(HInstance, str, RT_RCDATA);
try
Result := TControl(CreateObjectFromStream(nil, S));
finally
S.Free;
end;
end;
end;
initialization
RegisterFmxClasses([TMyFirstControl]);
end. fmx.myfirstcontrol.style
object TRectangle
StyleName = 'MyFirstControlStyle'
Position.Point = '(184,248)'
Width = 209.000000000000000000
Height = 105.000000000000000000
Fill.Kind = bkNone
Stroke.Kind = bkNone
object TRectangle
StyleName = 'background'
Align = alClient
Width = 209.000000000000000000
Height = 105.000000000000000000
object TButton
StyleName = 'Button1'
Position.Point = '(10,20)'
Width = 80.000000000000000000
Height = 22.000000000000000000
TabOrder = 0
Text = 'Button1'
end
object TEdit
StyleName = 'Edit1'
Position.Point = '(102,20)'
Width = 100.000000000000000000
Height = 22.000000000000000000
TabOrder = 1
KeyboardType = vktDefault
Password = False
end
object TRectangle
StyleName = 'rectangleElement'
Position.Point = '(11,48)'
Width = 65.000000000000000000
Height = 49.000000000000000000
Fill.Color = xFFFF4B4B
end
end
end fmx.myfirstcontrol.rc MyFirstControlStyle RCDATA "fmx.myfirstcontrol.style"
rt := (FindStyleResource(‘rectangleElement’) as TRectangle); rt.RotationAngle := MyRotationAngleProperty; //sample below 45°

TAdvSmoothTileListAdding items to the TAdvSmoothTileList from a TGDIPPictureContainer at runtime
First, add images to the picturecontainer at designtime. (name them '0', '1', '2')
Then at runtime, create items and set the ImageName property of the Content of the tile:
AdvSmoothTileList1.Tiles.Add.Content.ImageName := '0';

TMS Instrumentation WorkShop for FireMonkeyFireMonkey guidelines
More information on developing FireMonkey components and building / deploying on other platforms can be found on http://docwiki.embarcadero.com/RADStudio/en/FireMonkey_Components_Guide

TMS IntraWeb HTML5 Controls PackError when installing: [DCC Fatal Error] Unit4.pas(8): F2051 Unit IWHTML5Chart was compiled with a different version of
Make sure there is ONLY ONE version of TMS IntraWeb Components in your Delphi or C++Builder library path and that this version matches EXACTLY your IntraWeb version. Ie. TMS IntraWeb Components for IntraWeb version X.Y.Z will ONLY work with IntraWeb X.Y.Z, NO OTHER IntraWeb versions. Make sure there are no old TMS IntraWeb Component version files in your library path as well as no different IntraWeb versions on your system.

TAdvMemoHow to create own Syntax Highlighters with customer specified keywords
As TAdvMemo is a syntax highlighting memo control, this means that the colors of text are defined by syntax rules. If you want to change the color of a specific text in the memo, the only possibility to do this is to define this as a syntax rule.
You can write a custom syntax styler. This is a component that descends from TAdvCustomMemoStyler and defines all syntax rules to control the syntax highlighting in the memo. All included styler components are based on this.
As an example, you can download the TAdvPascalMemoStyler (ADVMPS.PAS), which is the styler used to set the colors for the Pascal language. If you want to set your own rules for applying color to text in the memo, you'd need to create a similar styler component as TAdvPascalMemoStyler and assign your own styler control to AdvMemo.SyntaxStyles.

TAdvMemoHow to show a breakpoint indicator for a line
You can set a breakpoint on a line with:
advmemo.BreakPoint[lineindex] := true;

TAdvMemoHow to use Autocompletion in TAdvMemo
If you drop a TAdvMemo & TAdvPascalMemoStyler on the form and link the styler to the memo, you can type "Show" and then Ctrl-Space and you will see the autocompletion.
Additional words to auto complete can be added via : styler.Autocompletion

TAdvStringGridHow to prevent navigation to specific cells
If you want to prevent navigation to specific cells, please implement the OnSelectCell event and set the parameter CanSelect = false for cells you want to prevent to be selected.

TAdvTaskDialogHow to translate the common buttons Yes, No, ...
The button text comes from the Unit Consts which is the common Delphi unit for translatable text also the text on buttons. If you use a Delphi translation tool, it should handle it correct to use a translated Consts unit and it should change the text on task dialog buttons too.

TAdvStringGridUsing balloons
- Only when theming is enabled in the project options, the balloon will be visible.
- If you reparent the grid, the balloon should only be enabled AFTER the final grid's parent is set.
- Balloon hints are an API from Microsoft Windows and this does not support HTML formatted text. This is a limitation of the Microsoft Windows balloon API.
- There is a limitation to the number of characters in a balloon. This is also a limitation of the Microsoft Windows balloon API that we cannot workaround. For a regular cell comment, there is no such length limitation.
- From TAdvStringGrid version v4.5, several new balloon notification capabilities have been added. See example 76: https://www.tmssoftware.com/site/asg76.asp
- When using AddBalloon& AddImageIdx on the same cell , the AddBalloon will not work. These 2 features are mutually exclusive, only one type per call can be added.
- When grid. Balloon.Enable = true, it will automatically show a balloon when a cell contains text, i.e. it will show the text of the cell in the balloon. To prevent this, add the following event handler:
procedure TForm4.AdvStringGrid1CellBalloon(Sender: TObject; ACol, ARow: Integer;
var ATitle, AText: string; var AIcon: Integer);
begin
if not advstringgrid1.HasBalloon(acol,arow) then
begin
atitle := '';
atext := '';
end;
end;
TAdvStringGridI am having problems with the sorting order of special characters in other languages
Please specify the ssAnsiAlphaCase sort type with following event handler:
procedure TForm18.AdvStringGrid1GetFormat(Sender: TObject; ACol: Integer;var AStyle: TSortStyle; var aPrefix, aSuffix: string); begin AStyle := ssAnsiAlphaCase; end;
The OnGetFormat event is used to instruct the grid which compare method it should use during the sorts for each column in the grid. By default, the grid is using an automatic format guess. Although this auto format guess can be convenient, for sorting large and complex amounts of data it is not recommended. When mixed numeric and alphabetic data is available in a column, this auto format guess is easily confused and the extra checks for guessing the format take extra time. With the OnGetFormat event, the compare methods to use can be specified for each column.
This is also explained at page 19 of the TAdvStringGrid Developers Guide.

TDBAdvGridAfter updating the ClientDataSets, data is missing in the grid and several rows are blank
Make sure that grid.PageMode = true and that grid.DataSetType = dtNonSequenced
That should improve the performance.
This is also explained at page 6 of the TDBADVGRID DEVELOPERS GUIDE:
Other than the column properties, some other settings need to be considered. With PageMode set to true, some datasets maintain internally an order for returning the pages of displayed rows to the grid and some not. This depends on the implementation of the TDataSet component that is used to connect to the database of choice. In general, when there is a problem with scrolling in the grid, it is recommended to set the property DataSetType to dtNonSequenced.

TWebUpdateHow to to turn off UAC prompt (registered version only)
Open WUPDATE.PAS and remove the line
{$DEFINE USEUAC}
in WUPDATE.PAS and it will be compiled with the resource that includes the updater that doesn't have the manifest to force starting with UAC.

TAdvSpreadGridHow to use the lookup function
LOOKUP(param; range1, range2) : returns the value of the element in range2 that has the index of the matching element in range1 for param
Example:
This code snippet shows how the lookup is performed for the value of 2 in range A1:A5 and the value is retrieved from range B1:B5
begin
advspreadGrid1.Cells[1,1] := '1';
advspreadGrid1.Cells[1,2] := '2';
advspreadGrid1.Cells[1,3] := '3';
advspreadGrid1.Cells[1,4] := '4';
advspreadGrid1.Cells[1,5] := '5';
advspreadGrid1.Cells[2,1] := 'BMW';
advspreadGrid1.Cells[2,2] := 'Audi';
advspreadGrid1.Cells[2,3] := 'Ferrari';
advspreadGrid1.Cells[2,4] := 'Mercedes';
advspreadGrid1.Cells[2,5] := 'Porsche';
advspreadGrid1.Cells[3,1] := '=LOOKUP("2";A1:A5;B1:B5)';
advspreadgrid1.Recalc;
end;

TAdvStringGridHow to programmatically start inplace editing
Make sure to FIRST set the grid.col/grid.row to the cell that must be edited and make sure the grid has focus. Then you can programmatically start inplace editing with grid.ShowInplaceEdit;
grid.Col := yourcolumn; grid.Row := yourrow; grid.SetFocus; grid.ShowInplaceEdit;
Implement the OnCellValidate event like:
procedure TForm4.AdvStringGrid1CellValidate(Sender: TObject; ACol, ARow: Integer; var Value: string; var Valid: Boolean); begin Valid := Value <> ''; end;