Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 691 to 705 of 888, page 47 of 60
<< previous next >>



What is the difference between TMS Advanced Charts for IntraWeb and TMS Advanced Charts
There is no difference.
TMS Advanced Charts for IntraWeb is equal to TMS Advanced Charts. The product contains chart components that can be used for VCL Windows application development as well as IntraWeb web application development.



Connection a detail item to a top layer item
Drop a new TAdvSmoothMegaMenu on the form, start the editor of the first root item to edit the sub menu. You will see a default section with 5 items. We will need to make the section width larger to add a top layer. When the section size increases the item width will also increase, so first add an item and set the ItemType to itBreak to split the section in 2 columns.
After the section has been divided, add a new top layer item and place it in the empty column.





Adding and connecting picturecontainer images to section items
Drop a TGDIPPictureContainer on the form, and add three items, named red, orange, green.








Adding Sections and Items
Adding a root menu with a section and 5 items
with AdvSmoothMegaMenu1.MenuItems.Add do begin Caption := 'Hello World !'; with Menu.Sections.Add do begin Caption := 'Section 0'; Items.Add.Text := 'Item 1'; Items.Add.Text := 'Item 2'; Items.Add.Text := 'Item 3'; Items.Add.Text := 'Item 4'; Items.Add.Text := 'Item 5'; end; end;
with AdvSmoothMegaMenu1.MenuItems.Add do begin Caption := 'Hello World !'; Menu.SectionLayout := slHorizontal; // Menu.SectionLayout := slVertical; for I := 0 to 1 do begin with Menu.Sections.Add do begin Caption := 'Section ' + inttostr(I); Items.Add.Text := 'Item 1'; Items.Add.Text := 'Item 2'; Items.Add.Text := 'Item 3'; Items.Add.Text := 'Item 4'; Items.Add.Text := 'Item 5'; end; end; end;
with AdvSmoothMegaMenu1.MenuItems.Add do begin Caption := 'Hello World !'; with Menu.Sections.Add do begin Caption := 'Section 0'; Items.Add.Text := 'Item 1'; Items.Add.Text := 'Item 2'; Items.Add.Text := 'Item 3'; Items.Add.Text := 'Item 4'; Items.Add.Text := 'Item 5'; Items.Add.ItemType := itBreak; Items.Add.Text := 'Item 1'; Items.Add.Text := 'Item 2'; Items.Add.Text := 'Item 3'; Items.Add.Text := 'Item 4'; Items.Add.Text := 'Item 5'; end; end;



How to use the design-time mini HTML editor at run-time
You can easily use the mini HTML design-time editor at run-time to allow users to edit the mini-HTML controls text at run-time. To allow this, use following steps : add the HTMLPROP unit to your project and add HTMLPROP to the uses clause in the unit from where you want to invoke the mini HTML editor. Add the following code to allow for example run-time editing of the content of a HTMLabel1 component :
var htmledit: THTMLEditor; begin htmledit := THTMLEditor.Create(Self); try htmledit.memo1.lines.Text := htmlabel1.htmltext.Text; htmledit.ShowModal; htmlabel1.htmltext.Text := htmledit.memo1.lines.Text; finally htmledit.Free; end; end;



Calculating checksums of files
To calculate the checksum of a file to put in the WebUpdate .INF control file, the function CRC32ChecksumOfFile can be used that is available in the unit wucrc32.pas.
Add this unit to the uses clause and use code:
var checksum: integer; begin checksum := CRC32ChecksumOfFile('myfile.ext'); end;



Using color banding in the grid
Select the colors for even rows and odd rows via Grid.Bands.PrimaryColor and Grid.Bands.SecondaryColor and set Grid.Bands.Active = true. For columns where you want to see the bands, set Grid.Columns[index].ShowBands = true.



Custom drawing in TPlannerCalendar
Via the OnCellDraw event, the days on a TPlannerCalendar can be fully custom drawn. In the code snippet presented, today is drawn with a yellow rectangular background while every odd day is painted with a bold font.
procedure TForm2.PlannerCalendar1CellDraw(Sender: TObject; Canvas: TCanvas; Day: TDate; Selected, Marked, InMonth: Boolean; Rect: TRect); var da,mo,ye: word; s: string; begin DecodeDate(day, ye, mo, da); if day = int(Now) then begin Canvas.Brush.Color := clYellow; Canvas.Rectangle(Rect); Canvas.Font.Color := clBlue; end; s := inttostr(da); if odd(Da) then Canvas.Font.Style := [fsBold]; inflateRect(rect,-1,-1); DrawText(Canvas.Handle, pchar(s), length(s), rect, DT_CENTER or DT_VCENTER); end;



Starting an application with a panel in locked state
Normally, when the application starts, by default a TAdvToolPanel starts in closed state. To programmatically control that a panel is always initially shown and locked on startup, following code can be used:
procedure TForm1.FormCreate(Sender: TObject); begin advtoolpanel1.Visible := true; advtoolpanel1.Locked := true; end;



Turn off dialogs during the update process
To turn off the dialog prompting to allow to proceed with the update and download updated files, set property WebUpdate.UpdateUpdate to wuuSilent.



Programmatically find and select text in the memo
Following code snippet shows how easy it is to programmatically search for the first occurence of text in the memo and select it:
begin advmemo1.FindText('text to find',[frDown]); advmemo1.SetFocus; end;
The search is from the memo cursor position. To search next occurences, just call this code again.



Using custom functions directly
The OnIsCustomFunction and OnCalcCustomFunction events can be used to implement custom functions for TAdvSpreadGrid. Via the event OnIsCustomFunction event, the grid is informed what names should be treated as custom functions and the OnCalcCustomFunction performs the actual calculation of the function. With the example code presented, the MYTEST function is added that returns as a result parameter * 2:
procedure TForm2.AdvSpreadGrid1CalcCustomFunction(sender: TObject; var func: string; var param: Double); begin if func='MYTEST' then param := param *2; end; procedure TForm2.AdvSpreadGrid1IsCustomFunction(sender: TObject; var func: string; var match: Boolean); begin match := func='MYTEST'; end; procedure TForm2.FormCreate(Sender: TObject); begin advspreadgrid1.Cells[1,1] := '1'; advspreadgrid1.Cells[1,2] := '=MYTEST(A1)'; advspreadgrid1.Recalc; end;



Destroy an alert message on anchor click
The code presented here shows an alert message and the TAdvAlertWindow.OnAnchorClick is used to handle the click on the anchor in the alert from where the message is destroyed.
begin with AdvAlertWindow1.AlertMessages.Add do begin Text.Text := 'This is an alert with HTML formatted text and anchor.'; AdvAlertWindow1.Show; end; end; procedure TForm2.AdvAlertWindow1AnchorClick(Sender: TObject; Anchor: string; Item: TMsgCollectionItem); begin AdvAlertWindow1.AlertMessages.FindItemID(item.ID).Free; ShowMessage('Anchor clicked'); end;
procedure TForm2.AdvAlertWindow1AnchorClick(Sender: TObject; Anchor: string; Item: TMsgCollectionItem); begin AdvAlertWindow1.AlertWindow.Hide; ShowMessage('Anchor clicked'); end;



Adding an email hyperlink in the task dialog
You can easily add a hyperlink for an email address that will automatically start the default email client with following code:
uses ShellAPI; procedure TForm2.Button1Click(Sender: TObject); begin TaskDialog1.Options := [doHyperlinks]; TaskDialog1.Title := 'TaskDialog with expandable text & footer with hyperlink'; TaskDialog1.Instruction := 'Do you like the Windows Vista TaskDialog?'; TaskDialog1.Icon := tiQuestion; TaskDialog1.Content := 'The new TaskDialog provides a standard & enhanced way for interacting with the user'; TaskDialog1.ExpandedText := 'Many new options make the TaskDialog very different from the old Windows MessageBox'; TaskDialog1.ExpandControlText := 'Click to hide'; TaskDialog1.CollapsControlText := 'Click to see more'; TaskDialog1.Footer := 'Brought to Delphi by TMS software'; TaskDialog1.FooterIcon := tfiWarning; TaskDialog1.Execute; end; procedure TForm2.TaskDialog1DialogHyperlinkClick(Sender: TObject; HRef: string); begin ShellExecute(0,'open',pchar(href),nil,nil,sw_normal); end;



After installing a new version of the TMS IntraWeb Components and running my application, I get an error similar to : error: property xyz does not exist
Upon opening the project in the IDE, open all forms, ignore this property error, save all form files and compile the project.