Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 211 to 225 of 886, page 15 of 60
<< previous next >>
TMS VCL Cloud Pack
TAdvGDrive: How to upload a file to a known folder without using GetDriveInfo
TAdvGDrive: How to upload a file to a known folder without using GetDriveInfo
Call "SearchFolder" with the folder name as a parameter. If that returns true, the first item of the "Drive" collection contains the required folder. Then call "Upload" with the folder object and the filename of the file to upload as parameters.
Example:
if AdvGDrive.SearchFolder('FolderName') then AdvGDrive.Upload(AdvGDrive.Drive.Items[0], 'FileName.ext');
TMS VCL Cloud Pack
Recurring events in Google calendars
Recurring events in Google calendars
The Recurrence and RecurringID properties of the TGCalendarItem are explained in the product manual PDF. Below you can find some extended information about these properties.
New recurring events:
Create a new event and simply assign a recurrence string to the Recurrence property and also fill in the relevant time zone in the TimeZone property. Then add the Event.
Example:
var li: TGCalendarItem; begin li := AdvGCalendar1.Items.Add; li.Summary := ''Summary''; li.Description := ''Description''; li.Location := ''Location''; li.Recurrence := ''RRULE:FREQ=DAILY;COUNT=5''; li.TimeZone := ''Europe/Brussels''; li.StartTime := dtStart; li.EndTime := dtEnd; li.CalendarID := sCalendarID; AdvGCalendar1.Add(li);
Existing recurring events:
A recurrent item consists of two types of events. The first is the parent event which contains the Recurrence string. The second are the instances of the recurrent item. By design, only the instances are retrieved when requesting a list of events. To retrieve the parent item separately you can use the RecurringID property value of one of the instances as the ItemID parameter for the GetItemById call.
TDBAdvGrid
TMS TDBAdvGrid & PageMode
TMS TDBAdvGrid & PageMode
TMS IntraWeb iPhone controls pack
How to populate the TIWIPhoneList asynchronously
How to populate the TIWIPhoneList asynchronously
You can use an asynchronous event (for example, the OnAsyncLeftButtonClick of the TIWIPhoneHeader component) to populate the TIWIPhoneList. It is also required to add a call to TIWIPhoneList1.AsyncItemsAdd after adding items asynchronously.
Example:
procedure TIWForm1.TIWIPhoneHeader1AsyncLeftButtonClick(Sender: TObject; EventParams: TStringList); var I: integer; begin for I := 0 to 50 - 1 do begin Inc(UserSession.pContaLin); with TIWIPhoneList1.Items.Add() do begin Caption := ''List Item '' + IntToStr(UserSession.pContaLin); Value := IntToStr(UserSession.pContaLin); Notes := ''notes: '' + IntToStr(UserSession.pContaLin); end; end; TIWIPhoneList1.AsyncItemsAdd; end;
TMS FMX UI Pack
TTMSFMXPlanner: How to insert a new Item with dblclick on Windows and Long-Tap on Mobile
TTMSFMXPlanner: How to insert a new Item with dblclick on Windows and Long-Tap on Mobile
For touch screens:
1) Drop an instance of GestureManager on the form and assign it to the Touch.GestureManager property of the TTMSFMXPlanner and check LongTap and DoubleTap under options under the InteractiveGestures property.
2) Add the following code:
procedure TForm1.TMSFMXPlanner1Gesture(Sender: TObject; const [Ref] EventInfo: TGestureEventInfo; var Handled: Boolean); begin if {$IFDEF MSWINDOWS}(EventInfo.GestureID = igiDoubleTap) or {$ENDIF} (EventInfo.GestureID = igiLongTap) and (TInteractiveGestureFlag.gfEnd in EventInfo.Flags) then begin if not Assigned(TMSFMXPlanner1.ActiveItem) then TMSFMXPlanner1.AddItemAtSelection; end end;
For non-touch screens:
Simply implement the OnDblClick event and use the following code:
procedure TForm1.TMSFMXPlanner1DblClick(Sender: TObject); begin if not Assigned(TMSFMXPlanner1.ActiveItem) then TMSFMXPlanner1.AddItemAtSelection; end;
TMS FMX UI Pack
TTMSFMXGrid: How to use a TTrackBar in a cell to update the value of another cell
TTMSFMXGrid: How to use a TTrackBar in a cell to update the value of another cell
This code snippet shows how to use a TTrackBar in a cell to update the value of another cell:
type TTMSFMXGridProtected = class(TTMSFMXGrid); procedure TForm1.FormCreate(Sender: TObject); begin TMSFMXGrid1.Options.Rendering.Mode := rmAddAsRealCell; end; procedure TForm1.TMSFMXGrid1GetCellClass(Sender: TObject; ACol, ARow: Integer; var CellClassType: TFmxObjectClass); begin if (ACol = 1) and (ARow > 0) then CellClassType := TTrackBar; end; procedure TForm1.TMSFMXGrid1GetCellProperties(Sender: TObject; ACol, ARow: Integer; Cell: TFmxObject); begin if (ACol = 1) and (ARow > 0) then (Cell as TTrackBar).OnChange := TrackBarChanged; end; procedure TForm1.TrackBarChanged(Sender: TObject); var cl: TCell; begin cl := TMSFMXGrid1.GetCellByObject(Sender as TFMXObject); TMSFMXGrid1.Cells[cl.Col + 1, cl.Row] := FloatToStr((Sender as TTrackBar).Value); end;
TMS VCL Cloud Pack
How to avoid '401 error: invalid_client' when using Google services
How to avoid '401 error: invalid_client' when using Google services
Please make sure to enter the “Email address” and “Product name” fields on the “OAuth consent screen” page at https://console.developers.google.com/
TMS VCL Cloud Pack
Download files from cloud storage service with ID or DownloadURL only
Download files from cloud storage service with ID or DownloadURL only
Different APIs provide different information or use different techniques. For example, unlike the Google Drive API, the OneDrive API does not provide a specific download URL for each file. However only the ID of the file is required to be able download the file, so you can create a dummy CloudItem with only the ID property assigned to be able to use the Download call. In case of Google Drive, you can use the same technique, but assign the DownloadURL property instead of the ID.
Examples:
OneDrive / SkyDrive
var i: TSkyDriveItem; begin i := TSkyDriveItem.Create(nil); i.ID := ''abc''; i.FileName := ''filename.ext''; AdvSkyDrive1.Download(i, i.FileName); i.Free;
Google Drive
var i: TGDriveItem; begin i := TGDriveItem.Create(nil); i.DownloadURL := ''abc''; i.FileName := ''filename.ext''; AdvGDrive1.Download(i, i.FileName); i.Free;
TMS FlexCel for VCL & FMX
Changing the background color of a cell in FlexCel
Changing the background color of a cell in FlexCel
It can be confusing that the code to change the background of a cell is something like:
fmt1.FillPattern.Pattern := TFlxPatternStyle.Solid; fmt1.FillPattern.FgColor := $00BCE4D8;
Why are we changing the FgColor instead of the BgColor in order to change the background color? And why does changing BgColor has no effect?
It can be a little confusing because of the names (which are the same the Excel documentation uses), but you need to understand that both FgColor and BgColor refer to the background color of a cell, and that’s why both are properties of the FillPattern. The foreground color is changed by changing the font color.
The thing is, in Excel, cells don’t need to have a solid fill, they can have a pattern fill. For example, here you have a “grid” pattern, where the foreground of the pattern is red, and the background of the pattern is yellow:
So, in FlexCel “FgColor” and “BgColor” both refer to the fill of the cell (never the foreground which as said is Font.Color). For the special case of Pattern = Solid (what we use in the 99.999% of the cases), then you set the FillPattern.Pattern to Solid, and BgColor doesn’t really matters. You can think of “Solid” as a pattern where everything is covered by the foreground color. The BgColor is still there, but not visible because FgColor covers all. If you set any other pattern than solid, you’ll see it more clearly.
TAdvSpreadGrid
How to show negative values in red within a cell with a formula
How to show negative values in red within a cell with a formula
This code snippet shows how to have negative values in red within a cell with a formula:
procedure TForm1.AdvSpreadGrid1GetCellColor(Sender: TObject; ARow, ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont); begin if AdvSpreadGrid1.CalculatedValue[acol,arow] < 0 then AFont.Color := clred; end;
TDBAdvGrid
How to format the numbers in the floatingfooter
How to format the numbers in the floatingfooter
The floatingfooter row can be treated as the last row in the grid. I.e. the format applied to the floating footer is the format of the cells at row position grid.RowCount -1.
You can use the event OnGetFloatFormat() to dynamically control this format of the last row.
TAdvOfficeButtons
TAdvOfficeRadioGroup: What is the difference between OnClick and OnCheckBoxClick
TAdvOfficeRadioGroup: What is the difference between OnClick and OnCheckBoxClick
When TAdvOfficeRadioGroup.CheckBox.Visible = true, the OnCheckBoxClick event is triggered when the caption checkbox is clicked. OnClick is the regular control's OnClick event.
TMS VCL WebGMaps
TMS WebGMaps in 64 bit
TMS WebGMaps in 64 bit
To use the components for 64 bit, just make sure the folder where TMS WebGMaps source are installed is included in your 64bit library path and compile your app for 64bit.
We don''t precompile in both debug / release and 32 & 64 bit mode because it means recompiling everything 4 times while just switching your app mode & target using the components is sufficient.
TMS IntraWeb Component Pack Pro
TTIWDBAdvWebGrid: How to display an image based on the original cell value
TTIWDBAdvWebGrid: How to display an image based on the original cell value
You can use the OnGetCellData event to display a custom value based on the original cell value. As you can''t change the column type on the fly, you must add an IMG tag with a direct link to the image file.
Example:
procedure TIWForm1.TIWDBAdvWebGrid1GetCellData(Sender: TObject; RowIndex, ColumnIndex: Integer; var AValue: string); begin if AValue = 'X' then AValue := '<img src="/files/image.png">' end;
Follow these steps to display image from an ImageListin the TIWAdvWebGrid:
- Assign the ImageList to the TIWDBAdvWebGrid.Images property.
- Set the Columns[].ColumnType to ctDataImage.
- Set the index of the Image in the ImageList as the cell value.
TMS IntraWeb Component Pack Pro
TTIWAdvWebGrid: How to add a background image
TTIWAdvWebGrid: How to add a background image
You can use the Background.PictureURL property to add a direct link to an image file. If you wish to use a relative path to link to the image file, just move the image file to a subfolder called “wwwroot” in the folder where the exe file is generated:
TIWDBAdvWebGrid1.Background.PictureURL := 'test.png';