ITabCellFormatDlg.ShowDialog

Fore Syntax

ShowDialog(ParentWnd: IWin32Window): Boolean;

Fore.NET Syntax

ShowDialog(ParentWnd: Prognoz.Platform.Interop.Tab.IWin32Window): boolean;

Parameters

ParentWnd - the window with respect to which the formatting dialog box opens modally.

Description

The ShowDialog method shows formatting dialog box and returns result with which this dialog box was closed.

Comments

The method returns True if the OK button was pressed after editing, and False if the Cancel button was pressed after editing.

Fore Example

Executing the example requires a form with a button having the Button1 identifier, the TabSheetBox component and the UiTabSheet component with the UiTabSheet1 identifier, which is the data source for TabSheetBox.

This example is a handler of the OnClick event for the Button1 component.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    FormatDlg: ITabCellFormatDlg;
    Sel: ITabSelection;
    SelRange: ITabRange;
Begin
    FormatDlg := New TabCellFormatDlg.Create;
    // Exclude
    FormatDlg.ExcludePage(TabFormatDlgPages.CellAlignment);
    FormatDlg.ExcludePage(TabFormatDlgPages.CellBorders);
   // Block:
    FormatDlg.DisableItem(TabFormatDlgItems.FontName);
    FormatDlg.DisableItem(TabFormatDlgItems.FontBold);
    FormatDlg.DisableItem(TabFormatDlgItems.Category);
    // Choose active page
    FormatDlg.ActivePage := TabFormatDlgPages.CellView;
    If FormatDlg.ShowDialog(Self As IWin32Window) Then
        Sel := UiTabSheet1.TabSheet.View.Selection;
        SelRange := Sel.Range;
        SelRange.Style := FormatDlg.Style;
    End If;
End Sub Button1OnClick;

Clicking the button opens formatting dialog box on the Fill tab. In the dialog box the Alignment and Borders tabs are hidden and it will not be available to set font name, to set bold text attribute and to select any data format. Select desired style settings and click the OK button to apply style to selected cells.

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example. Use Fore.NET analogs instead of Fore components.

Imports Prognoz.Platform.Interop.Tab;

Private
 Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    FormatDlg: ITabCellFormatDlg;
    Sel: ITabSelection;
    SelRange: ITabRange;
Begin
    FormatDlg := New TabCellFormatDlgClass();
    // Exclude
    FormatDlg.ExcludePage(TabFormatDlgPages.tfdpCellAlignment);
    FormatDlg.ExcludePage(TabFormatDlgPages.tfdpCellBorders);
    // Block:
    FormatDlg.DisableItem(TabFormatDlgItems.tfdiFontName);
    FormatDlg.DisableItem(TabFormatDlgItems.tfdiFontBold);
    FormatDlg.DisableItem(TabFormatDlgItems.tfdiCategory);
    // Choose active page
    FormatDlg.ActivePage := TabFormatDlgPages.tfdiCellView;
    If FormatDlg.ShowDialog(New IWin32WindowForeAdapter(Self)) Then
        Sel := UiTabSheetNet1.TabSheetUi.TabSheet.View.Selection;
        SelRange := Sel.Range;
        SelRange.Style := FormatDlg.Style;
    End If;
End Sub;

See also:

ITabCellFormatDlg