Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 301 to 315 of 888, page 21 of 60
<< previous next >>



How to customize the text of the sidebar
With the event Planner.OnPlannerGetSidebarLines , you can fully customize the text of the sidebar. This event is triggered when the Planner needs the text for the 3 lines that can appear in the sidebar. With this event , you can customize the text, i.e. control the format of the hour displayed there. Or for example to remove the text at specific time slots.
Example 1: hide the display for minutes:
procedure TForm4.Planner1PlannerGetSideBarLines(Sender: TObject; Index, Position: Integer; var HourString, MinuteString, AmPmString: string); begin MinuteString := ''''; end;
Example 2:
procedure TForm4.Planner1PlannerGetSideBarLines(Sender: TObject; Index, Position: Integer; var HourString, MinuteString, AmPmString: string); begin if index mod 4 = 0 then HourString := inttostr(....) else HourString := ''''; end;



How to add images in a Planner header
Using mini HTML formatted text in the caption you can insert images in the header. You can do this with the <IMG> tag in the text with a reference to an image index in the imagelist assigned to Planner.PlannerImages. For info on using mini HTML formatted text, please see: https://www.tmssoftware.com/site/minihtml.asp
Example:
with Planner1.Header do begin Captions.Clear; Captions.Add(''''); //take first sidebar header section into account Captions.Add(''<img src="idx:0"> <b>Product</b>''); Captions.Add(''<img src="idx:1"> <b>Info</b>''); Captions.Add(''<img src="idx:2"> <b>New</b>''); end;




Using HTML template items in TDBAdvCardList
In CardTemplate.Items[index].ItemType , you can now set the type to itHTMLText. You can use CardTemplate.Items[index].HTMLTemplate to set the template for the HTML text for the item. DB fields are invoked via <#FIELDNAME> in the template. Other than this, HTML tags can be used described at https://www.tmssoftware.com/site/minihtml.asp
Example:
When TDBAdvCardList is bound to a dataset containing cars that has the fields BRAND, TYPE, CC and PK, these can be combined into on card item in TDBAdvCardList by setting the template to:
'Car:<b><#BRAND></b><BR><#TYPE> Engine: cc:<FONT COLOR="clBlue"><#CC></FONT>/pk:<FONT COLOR="clGreen"><#PK></FONT>'
Combined with setting the CaptionField to BRAND and add an item directly connected to PRICE and COUNTRY fields, the result is:




Taking a screenshot in Android
The code below takes a screenshot of an instance of TTMSFMXWebGmaps and saves it to a file:
units
AndroidApi.JNI.Embarcadero, AndroidApi.JNI.GraphicsContentViewText, AndroidApi.JNI.JavaTypes, AndroidApi.Helpers, FMX.Objects, IOUtils
var web: JWebBrowser; pic: JPicture; bmp: JBitmap; c: JCanvas; fos: JFileOutputStream; fn: string; begin fn := TPath.GetDocumentsPath + PathDelim + ''sample.jpg''; web := TJWebBrowser.Wrap(TMSFMXWebGMaps1.NativeBrowser); pic := web.capturePicture; bmp := TJBitmap.JavaClass.createBitmap(pic.getWidth, pic.getHeight, TJBitmap_Config.JavaClass.ARGB_8888); c := TJCanvas.JavaClass.init(bmp); pic.draw(c); fos := TJFileOutputStream.JavaClass.init(StringToJString(fn)); if Assigned(fos) then begin bmp.compress(TJBitmap_CompressFormat.JavaClass.JPEG, 100, fos); fos.close; end; end;



Using the TTMSFMXWebGMaps inside a TTabControl
The TTMSFMXWebGMaps is a wrapper around the native webbrowser. When dropping the component on the form, the webbrowser follows the position and alignment of the wrapper control. There is however a technical limitation when using it as a child of a TTabControl. The native webbrowser doesn''t respond to tab changes, therefore you need to manually toggle the visible property. The following example demonstrates this technique when placing the TTMSFMXWebGMaps control on one of the pages of a TTabControl.
procedure TForm1.TabControl1Change(Sender: TObject); begin TMSFMXWebGMaps1.Visible := TabControl1.ActiveTab = TabItem3; end;



How to disable an item in the drop-down list
Set ItemEnabled from the event OnShowCheckList, at that point the dropdown checklist is created and ItemEnabled[] can be set.
Example:
procedure TForm1.CheckListEdit1ShowCheckList(Sender: TObject); begin CheckListEdit1.ItemEnabled[2]:=false; end;



How to export to PDF
Drop a TAdvgridPDFIO component on the form and connect the TAdvStringGrid to this nonvisual component''s TAdvStringGrid property.
Then simply call:
AdvgridPDFIO.Save(FileName);
After you called Save(FileName) you can call ShellExecute(0,''open'',Char(FileName),nil,nil,SW_NORMAL)
to automatically open this PDF after having it produced. TAdvgridPDFIO comes with settings for header and footer as well as metadata. Header and footer can as such be optionally generated for the PDF file independently from the TAdvStringGrid content.



How to change the font
Set:
AdvGlowbutton.ParentFont = false
AdvGlowbutton.Appearance.SystemFont = false
When ParentFont = False and Appearance.SystemFont = true, the button will automatically use the recommended system font depending on the operating system used, ie. Segoe UI on Windows 7 and Tahoma on Windows XP.



When using the TAdvSpinEdit as a spintype of sptFloat I can not enter a number with decimals
Set AdvSpinEdit.Precision = 2



Using the TAdvSpinEdit constraints (MaxValue, MinValue)
If you want that the min/max values are checked, please set
AdvSpinEdit.CheckMinValue := true; AdvSpinEdit.CheckMaxValue := true;



Polygons created from the coordinates retrieved from the GetDirections call are not displayed exactly on top of map roads.
Please note that the precision of the route path coordinates retrieved from the GetDirections call is limited. Unfortunately this is a limitation of the Google Maps Directions API which we have no control over.
Alternatively you can use the RenderDirections call to display the route using the Google API instead of using a Polyline. This technique has better precision.
Example:
WebGMaps1.RenderDirections('Hamburg', 'Hannover');



How to programmatically open / close a panel
You can programmatically open / close a panel in imMultiPanelActive mode by toggling the Panel.Open: Boolean property.



Taking a screenshot in iOS
The code below generates a TBitmap from an instance of TTMSFMXWebOSMaps.
units
iOSApi.UIKit, MacApi.Dispatch, iOSApi.CoreGraphics, iOSApi.Foundation, MacApi.ObjectiveC, FMX.Objects, FMX.StdCtrls;
procedure UIGraphicsBeginImageContext(size: CGSize); cdecl; external libUIKit name _PU + 'UIGraphicsBeginImageContext'; implementation function BitmapFromImage(AImage: UIImage): TBitmap; var dt: NSData; ms: TMemoryStream; begin Result := nil; if not Assigned(AImage) then Exit; dt := TNSData.Wrap(UIImagePNGRepresentation((AImage as ILocalObject).GetObjectID)); if Assigned(dt) then begin Result := TBitmap.Create(0, 0); ms := TMemoryStream.Create; ms.Write(dt.bytes^, dt.length); Result.LoadFromStream(ms); ms.Free; end; end; procedure TForm1.Button1Click(Sender: TObject); var vw: UIView; img: UIImage; bmp: TBitmap; begin vw := TUIView.Wrap(TMSFMXWebOSMaps1.NativeBrowser); UIGraphicsBeginImageContext(vw.bounds.size); vw.layer.renderInContext(UIGraphicsGetCurrentContext); img := TUIImage.Wrap(UIGraphicsGetImageFromCurrentImageContext); bmp := BitmapFromImage(img); Image1.Bitmap.Assign(bmp); bmp.free; UIGraphicsEndImageContext; end;



Taking a screenshot in iOS
The code below generates a TBitmap from an instance of TTMSFMXWebGMaps.
units
iOSApi.UIKit, MacApi.Dispatch, iOSApi.CoreGraphics, iOSApi.Foundation, MacApi.ObjectiveC, FMX.Objects, FMX.StdCtrls;
procedure UIGraphicsBeginImageContext(size: CGSize); cdecl; external libUIKit name _PU + 'UIGraphicsBeginImageContext'; implementation function BitmapFromImage(AImage: UIImage): TBitmap; var dt: NSData; ms: TMemoryStream; begin Result := nil; if not Assigned(AImage) then Exit; dt := TNSData.Wrap(UIImagePNGRepresentation((AImage as ILocalObject).GetObjectID)); if Assigned(dt) then begin Result := TBitmap.Create(0, 0); ms := TMemoryStream.Create; ms.Write(dt.bytes^, dt.length); Result.LoadFromStream(ms); ms.Free; end; end; procedure TForm1.Button1Click(Sender: TObject); var vw: UIView; img: UIImage; bmp: TBitmap; begin vw := TUIView.Wrap(TMSFMXWebGMaps1.NativeBrowser); UIGraphicsBeginImageContext(vw.bounds.size); vw.layer.renderInContext(UIGraphicsGetCurrentContext); img := TUIImage.Wrap(UIGraphicsGetImageFromCurrentImageContext); bmp := BitmapFromImage(img); Image1.Bitmap.Assign(bmp); bmp.free; UIGraphicsEndImageContext; end;



When connecting to FaceBook, I get an error similar to: "Given URL is not allowed by the Application configuration...or the domain must be a subdomain of one of the App"s domains."
Please check if the following settings are correct for your App on developers.facebook.com
- Settings/Basic
App Domains: localhost
Site URL: http://localhost/
- Settings/Advanced
Client OAuth Login: Yes
Embedded Browser OAuth Login: Yes