Table of Contents

Class RDFormsFormWindow

Namespace
RDCore.Forms.Avalonia.Rendering
Assembly
RDCore.Forms.Avalonia.dll

A window that shows a VB form: its RDFormsFormView, titled with the form's caption.

public sealed class RDFormsFormWindow : Window, INotifyPropertyChanged, IDataContextProvider, IThemeVariantHost, IResourceHost, IResourceNode, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, INamed, IInputElement, IDataTemplateHost, ISetterValue, ICloseable, IStyleHost, ILogicalRoot, ILogical, IFocusScope, IMenuHost
Inheritance
AvaloniaObject
Animatable
StyledElement
Visual
Layoutable
Interactive
InputElement
Control
TemplatedControl
ContentControl
TopLevel
WindowBase
Window
RDFormsFormWindow
Implements
IDataContextProvider
IThemeVariantHost
IResourceHost
IResourceNode
ISetLogicalParent
ISetInheritanceParent
INamed
IInputElement
IDataTemplateHost
ISetterValue
ICloseable
IStyleHost
ILogicalRoot
ILogical
IFocusScope
Inherited Members
Window.SizeToContentProperty
Window.ExtendClientAreaToDecorationsHintProperty
Window.ExtendClientAreaTitleBarHeightHintProperty
Window.IsExtendedIntoWindowDecorationsProperty
Window.WindowDecorationMarginProperty
Window.OffScreenMarginProperty
Window.WindowDecorationsProperty
Window.WindowDecorationsThemeProperty
Window.ShowActivatedProperty
Window.ShowInTaskbarProperty
Window.ClosingBehaviorProperty
Window.WindowStateProperty
Window.TitleProperty
Window.IconProperty
Window.WindowStartupLocationProperty
Window.CanResizeProperty
Window.CanMinimizeProperty
Window.CanMaximizeProperty
Window.WindowClosedEvent
Window.WindowOpenedEvent
Window.BeginMoveDrag(PointerPressedEventArgs)
Window.BeginResizeDrag(WindowEdge, PointerPressedEventArgs)
Window.Close()
Window.Hide()
Window.Show()
Window.Show(Window)
Window.ShowDialog(Window)
Window.ShowDialog<TResult>(Window)
Window.PlatformImpl
Window.OwnedWindows
Window.SizeToContent
Window.Title
Window.ExtendClientAreaToDecorationsHint
Window.ExtendClientAreaTitleBarHeightHint
Window.IsExtendedIntoWindowDecorations
Window.WindowDecorationMargin
Window.OffScreenMargin
Window.WindowDecorations
Window.WindowDecorationsTheme
Window.SystemDecorations
Window.ShowActivated
Window.ShowInTaskbar
Window.ClosingBehavior
Window.WindowState
Window.CanResize
Window.CanMinimize
Window.CanMaximize
Window.Icon
Window.WindowStartupLocation
Window.Position
Window.IsDialog
Window.Closing
WindowBase.IsActiveProperty
WindowBase.OwnerProperty
WindowBase.TopmostProperty
WindowBase.Activate()
WindowBase.IsActive
WindowBase.Screens
WindowBase.Owner
WindowBase.Topmost
WindowBase.DesktopScaling
WindowBase.Activated
WindowBase.Deactivated
WindowBase.PositionChanged
WindowBase.Resized
TopLevel.ClientSizeProperty
TopLevel.FrameSizeProperty
TopLevel.TransparencyLevelHintProperty
TopLevel.ActualTransparencyLevelProperty
TopLevel.TransparencyBackgroundFallbackProperty
TopLevel.ActualThemeVariantProperty
TopLevel.RequestedThemeVariantProperty
TopLevel.SystemBarColorProperty
TopLevel.AutoSafeAreaPaddingProperty
TopLevel.BackRequestedEvent
TopLevel.TryGetPlatformHandle()
TopLevel.SetSystemBarColor(Control, SolidColorBrush)
TopLevel.GetSystemBarColor(Control)
TopLevel.GetAutoSafeAreaPadding(Control)
TopLevel.GetTopLevel(Visual)
TopLevel.ClientSize
TopLevel.FrameSize
TopLevel.TransparencyLevelHint
TopLevel.ActualTransparencyLevel
TopLevel.TransparencyBackgroundFallback
TopLevel.RequestedThemeVariant
TopLevel.RendererDiagnostics
TopLevel.RenderScaling
TopLevel.StorageProvider
TopLevel.InsetsManager
TopLevel.InputPane
TopLevel.Launcher
TopLevel.Clipboard
TopLevel.FocusManager
TopLevel.Opened
TopLevel.Closed
TopLevel.ScalingChanged
TopLevel.BackRequested
ContentControl.ContentProperty
ContentControl.ContentTemplateProperty
ContentControl.HorizontalContentAlignmentProperty
ContentControl.VerticalContentAlignmentProperty
ContentControl.Content
ContentControl.ContentTemplate
ContentControl.Presenter
ContentControl.HorizontalContentAlignment
ContentControl.VerticalContentAlignment
TemplatedControl.BackgroundProperty
TemplatedControl.BackgroundSizingProperty
TemplatedControl.BorderBrushProperty
TemplatedControl.BorderThicknessProperty
TemplatedControl.CornerRadiusProperty
TemplatedControl.FontFamilyProperty
TemplatedControl.FontFeaturesProperty
TemplatedControl.FontSizeProperty
TemplatedControl.FontStyleProperty
TemplatedControl.FontWeightProperty
TemplatedControl.FontStretchProperty
TemplatedControl.ForegroundProperty
TemplatedControl.LetterSpacingProperty
TemplatedControl.PaddingProperty
TemplatedControl.TemplateProperty
TemplatedControl.IsTemplateFocusTargetProperty
TemplatedControl.TemplateAppliedEvent
TemplatedControl.GetIsTemplateFocusTarget(Control)
TemplatedControl.ApplyTemplate()
TemplatedControl.Background
TemplatedControl.BackgroundSizing
TemplatedControl.BorderBrush
TemplatedControl.BorderThickness
TemplatedControl.CornerRadius
TemplatedControl.FontFamily
TemplatedControl.FontFeatures
TemplatedControl.FontSize
TemplatedControl.FontStyle
TemplatedControl.FontWeight
TemplatedControl.FontStretch
TemplatedControl.Foreground
TemplatedControl.LetterSpacing
TemplatedControl.Padding
TemplatedControl.Template
TemplatedControl.TemplateApplied
Control.FocusAdornerProperty
Control.TagProperty
Control.ContextMenuProperty
Control.ContextFlyoutProperty
Control.RequestBringIntoViewEvent
Control.LoadedEvent
Control.UnloadedEvent
Control.SizeChangedEvent
Control.FocusAdorner
Control.DataTemplates
Control.ContextMenu
Control.ContextFlyout
Control.IsLoaded
Control.Tag
Control.Loaded
Control.Unloaded
Control.SizeChanged
InputElement.FocusableProperty
InputElement.IsEnabledProperty
InputElement.IsEffectivelyEnabledProperty
InputElement.CursorProperty
InputElement.IsKeyboardFocusWithinProperty
InputElement.IsFocusedProperty
InputElement.IsHitTestVisibleProperty
InputElement.IsPointerOverProperty
InputElement.IsTabStopProperty
InputElement.GotFocusEvent
InputElement.GettingFocusEvent
InputElement.LostFocusEvent
InputElement.LosingFocusEvent
InputElement.KeyDownEvent
InputElement.KeyUpEvent
InputElement.TabIndexProperty
InputElement.TextInputEvent
InputElement.TextInputMethodClientRequestedEvent
InputElement.PointerEnteredEvent
InputElement.PointerExitedEvent
InputElement.PointerMovedEvent
InputElement.PointerPressedEvent
InputElement.PointerReleasedEvent
InputElement.PointerCaptureLostEvent
InputElement.PointerWheelChangedEvent
InputElement.ContextRequestedEvent
InputElement.ContextCanceledEvent
InputElement.IsHoldingEnabledProperty
InputElement.IsHoldWithMouseEnabledProperty
InputElement.PinchEvent
InputElement.PinchEndedEvent
InputElement.PullGestureEvent
InputElement.PullGestureEndedEvent
InputElement.SwipeGestureEvent
InputElement.SwipeGestureEndedEvent
InputElement.ScrollGestureEvent
InputElement.ScrollGestureInertiaStartingEvent
InputElement.ScrollGestureEndedEvent
InputElement.PointerTouchPadGestureMagnifyEvent
InputElement.PointerTouchPadGestureRotateEvent
InputElement.PointerTouchPadGestureSwipeEvent
InputElement.TappedEvent
InputElement.RightTappedEvent
InputElement.HoldingEvent
InputElement.DoubleTappedEvent
InputElement.Focus(NavigationMethod, KeyModifiers)
InputElement.GetIsHoldingEnabled(StyledElement)
InputElement.GetIsHoldWithMouseEnabled(StyledElement)
InputElement.Focusable
InputElement.IsEnabled
InputElement.Cursor
InputElement.IsKeyboardFocusWithin
InputElement.IsFocused
InputElement.IsHitTestVisible
InputElement.IsPointerOver
InputElement.IsTabStop
InputElement.IsEffectivelyEnabled
InputElement.TabIndex
InputElement.KeyBindings
InputElement.GestureRecognizers
InputElement.GotFocus
InputElement.GettingFocus
InputElement.LostFocus
InputElement.LosingFocus
InputElement.KeyDown
InputElement.KeyUp
InputElement.TextInput
InputElement.TextInputMethodClientRequested
InputElement.PointerEntered
InputElement.PointerExited
InputElement.PointerMoved
InputElement.PointerPressed
InputElement.PointerReleased
InputElement.PointerCaptureLost
InputElement.PointerWheelChanged
InputElement.ContextRequested
InputElement.ContextCanceled
InputElement.Pinch
InputElement.PinchEnded
InputElement.PullGesture
InputElement.PullGestureEnded
InputElement.ScrollGesture
InputElement.ScrollGestureInertiaStarting
InputElement.ScrollGestureEnded
InputElement.PointerTouchPadGestureMagnify
InputElement.PointerTouchPadGestureRotate
InputElement.SwipeGesture
InputElement.SwipeGestureEnded
InputElement.PointerTouchPadGestureSwipe
InputElement.Tapped
InputElement.RightTapped
InputElement.Holding
InputElement.DoubleTapped
Interactive.RaiseEvent(RoutedEventArgs)
Layoutable.DesiredSizeProperty
Layoutable.WidthProperty
Layoutable.HeightProperty
Layoutable.MinWidthProperty
Layoutable.MaxWidthProperty
Layoutable.MinHeightProperty
Layoutable.MaxHeightProperty
Layoutable.MarginProperty
Layoutable.HorizontalAlignmentProperty
Layoutable.VerticalAlignmentProperty
Layoutable.UseLayoutRoundingProperty
Layoutable.UpdateLayout()
Layoutable.Measure(Size)
Layoutable.Arrange(Rect)
Layoutable.InvalidateMeasure()
Layoutable.InvalidateArrange()
Layoutable.Width
Layoutable.Height
Layoutable.MinWidth
Layoutable.MaxWidth
Layoutable.MinHeight
Layoutable.MaxHeight
Layoutable.Margin
Layoutable.HorizontalAlignment
Layoutable.VerticalAlignment
Layoutable.DesiredSize
Layoutable.IsMeasureValid
Layoutable.IsArrangeValid
Layoutable.UseLayoutRounding
Layoutable.EffectiveViewportChanged
Layoutable.LayoutUpdated
Visual.BoundsProperty
Visual.ClipToBoundsProperty
Visual.ClipProperty
Visual.IsVisibleProperty
Visual.OpacityProperty
Visual.OpacityMaskProperty
Visual.CacheModeProperty
Visual.EffectProperty
Visual.HasMirrorTransformProperty
Visual.RenderTransformProperty
Visual.RenderTransformOriginProperty
Visual.FlowDirectionProperty
Visual.VisualParentProperty
Visual.ZIndexProperty
Visual.GetFlowDirection(Visual)
Visual.SetFlowDirection(Visual, FlowDirection)
Visual.InvalidateVisual()
Visual.Render(DrawingContext)
Visual.Bounds
Visual.ClipToBounds
Visual.Clip
Visual.IsEffectivelyVisible
Visual.IsVisible
Visual.Opacity
Visual.OpacityMask
Visual.CacheMode
Visual.Effect
Visual.HasMirrorTransform
Visual.RenderTransform
Visual.RenderTransformOrigin
Visual.FlowDirection
Visual.ZIndex
Visual.AttachedToVisualTree
Visual.DetachedFromVisualTree
StyledElement.DataContextProperty
StyledElement.NameProperty
StyledElement.ParentProperty
StyledElement.TemplatedParentProperty
StyledElement.ThemeProperty
StyledElement.BeginInit()
StyledElement.EndInit()
StyledElement.ApplyStyling()
StyledElement.Name
StyledElement.Classes
StyledElement.DataContext
StyledElement.IsInitialized
StyledElement.Styles
StyledElement.StyleKey
StyledElement.Resources
StyledElement.TemplatedParent
StyledElement.Theme
StyledElement.Parent
StyledElement.ActualThemeVariant
StyledElement.AttachedToLogicalTree
StyledElement.DetachedFromLogicalTree
StyledElement.DataContextChanged
StyledElement.Initialized
StyledElement.ResourcesChanged
StyledElement.ActualThemeVariantChanged
Animatable.TransitionsProperty
Animatable.Transitions
AvaloniaObject.CheckAccess()
AvaloniaObject.VerifyAccess()
AvaloniaObject.ClearValue(AvaloniaProperty)
AvaloniaObject.ClearValue<T>(AvaloniaProperty<T>)
AvaloniaObject.ClearValue<T>(StyledProperty<T>)
AvaloniaObject.ClearValue<T>(DirectPropertyBase<T>)
AvaloniaObject.GetHashCode()
AvaloniaObject.GetValue(AvaloniaProperty)
AvaloniaObject.GetValue<T>(StyledProperty<T>)
AvaloniaObject.GetValue<T>(DirectPropertyBase<T>)
AvaloniaObject.GetBaseValue<T>(StyledProperty<T>)
AvaloniaObject.IsAnimating(AvaloniaProperty)
AvaloniaObject.IsSet(AvaloniaProperty)
AvaloniaObject.SetValue<T>(StyledProperty<T>, T, BindingPriority)
AvaloniaObject.SetValue<T>(DirectPropertyBase<T>, T)
AvaloniaObject.SetCurrentValue<T>(StyledProperty<T>, T)
AvaloniaObject.Bind(AvaloniaProperty, BindingBase)
AvaloniaObject.CoerceValue(AvaloniaProperty)
AvaloniaObject.this[AvaloniaProperty]
AvaloniaObject.this[IndexerDescriptor]
AvaloniaObject.Dispatcher
AvaloniaObject.PropertyChanged

Remarks

The window's client area is the form's: its size is the root's Width and Height, in pixels, and follows them. A user who resizes the window sets them. The client area scrolls in its Scroller, by the root's ScrollLeft and ScrollTop, over at least its ScrollWidth by ScrollHeight, and raises the root's Scroll. The form's menus are on its MenuBar, above the client area, and a menu item's shortcut chooses it before a control or the root sees the key. Enter clicks the focused CommandButton, or else the form's first CommandButton whose Default is True, and Esc the first whose Cancel is True, with no key event, the root's included: a button that is hidden or disabled takes no key, and a combo's open list keeps both keys. The button Enter clicks has the default look, and no other (see RDFormsCommandButton). While it is open, the window is its root's IMenuHost, registered with MenuHosts, and a right release over a component whose ContextMenu names one of the form's menus pops it up at the pointer, after the component's MouseUp and Click. The window follows the root's Caption, Icon, MaxButton, MinButton and ShowInTaskbar. Its StartUpPosition chooses where it starts: CenterOwner and CenterScreen centre it, and Manual and Windows Default leave its place to the window system.

The controls and the root raise their events to the sink set on the window with SetEventSink(Control, IComponentEventSink?). A window with no sink raises none. The root's own events, as VB6 raises them:

  • Resize, inside Avalonia.Controls.Window.Show() the first time the window is shown, and once for each change of the root's Width or Height after that. A size the root already has raises none, and neither does showing the window again after it was hidden.
  • Activate, as the window becomes the active one of its Program's form windows, after the Resize that shows it; Deactivate on the window of that program that was, before it. Another application, or another program's window, taking the activation and giving it back raises nothing. A window whose root is disabled is shown without being activated.
  • The focus, as the window is activated: after the Activate, the control that last had the focus on the form takes it again, or the first control of the tab order that can take it, with a GotFocus. A form with none raises its own GotFocus. The control that has the focus raises its LostFocus before the form's Deactivate, and a form with none its own.
  • DblClick, on a double click's second press on none of the form's controls, in place of its MouseDown.
  • QueryUnload, then Unload, as the user closes the window, with an UnloadMode of 0. A handler that sets Cancel to another value keeps the window open. Unload() raises them as VB's Unload statement does, and Avalonia.Controls.Window.Close() closes the window and raises neither, as VB's End does. A window whose UnloadRequestHandler is set raises neither as the user closes it: it stays open and hands the close to the handler.
  • KeyDown, KeyPress and KeyUp, for a key pressed while none of the form's controls has the focus, and for every key first where the root's KeyPreview is True.

Initialize, Load and Terminate are the program's to raise: the window raises none of them.

Constructors

RDFormsFormWindow(FormDefinition)

Creates a window that shows a form.

public RDFormsFormWindow(FormDefinition form)

Parameters

form FormDefinition

The form.

Remarks

Its file lists show the machine's file system, from the process's current directory.

Exceptions

ArgumentNullException

form is null.

ArgumentException

The root of form is not a Form.

RDFormsFormWindow(FormDefinition, IFileSystem)

Creates a window that shows a form, with the file system its file lists show.

public RDFormsFormWindow(FormDefinition form, IFileSystem fileSystem)

Parameters

form FormDefinition

The form.

fileSystem IFileSystem

The file system the form's file lists show, from its current directory.

Exceptions

ArgumentNullException

form or fileSystem is null.

ArgumentException

The root of form is not a Form.

Properties

ActiveControl

The component whose control has the focus on the form, or had it last: VB's ActiveControl. null where none of the form's controls has had the focus.

public ComponentInstance? ActiveControl { get; }

Property Value

ComponentInstance

Remarks

A SetFocus call names its control here at once, before the focus moves.

KeepSystemTheme

Whether the window keeps the system's theme: RD-VBA's App.KeepSystemTheme, which the host gives each window it makes.

public bool KeepSystemTheme { get; set; }

Property Value

bool

Remarks

false, the default, shows the form in the light theme variant whatever the application's theme, as VB6 shows a form in Windows' light colours. true shows it in the application's theme variant, and follows it as it changes.

The form's system colours, its menu bar's included, are drawn in the window's variant, with FormPalette's palette for it; a colour set as RGB is drawn as it is. The value can change while the window is shown: the form is drawn again in its new variant. Each window has its own value.

MenuBar

The form's menu bar, above its client area: hidden while none of the bar's items is visible.

public RDFormsMenuBar MenuBar { get; }

Property Value

RDFormsMenuBar

PoppedUpMenu

The menu PopupMenu(FormMenuItem, double?, double?, PopupMenuAlignment, FormMenuItem?) last popped up, while it is open: null once it has closed.

public ContextMenu? PoppedUpMenu { get; }

Property Value

ContextMenu

Program

The program the form is one of, whose windows share one active form: Activate, Deactivate, and the GotFocus and LostFocus that come with them, follow the activation among that program's windows only.

public RDFormsProgram Program { get; init; }

Property Value

RDFormsProgram

Remarks

Default unless it is set as the window is made: every window given none is of the one program.

Root

The form's root.

public ComponentInstance Root { get; }

Property Value

ComponentInstance

Scroller

The scroll viewer the client area is in: its size is the form's Width and Height, and its offset the form's ScrollLeft and ScrollTop.

public ScrollViewer Scroller { get; }

Property Value

ScrollViewer

UnloadRequestHandler

What handles a close the user or the system asks for, in place of the window's own QueryUnload and Unload: null, the default, for a window that raises them itself.

public Action<int>? UnloadRequestHandler { get; set; }

Property Value

Action<int>

Remarks

A host whose program raises the form's QueryUnload and Unload itself, such as one whose program runs in another process, sets it. The window then refuses the close, raises neither event, and calls the handler with the close's UnloadMode: 0 for the close box or Alt+F4, 2 as the system shuts down, 5 as the window's owner closes. The handler is called on the UI thread after the close is refused, never inside it. Once the program has unloaded the form, the host closes the window with Avalonia.Controls.Window.Close(), which raises nothing; a program that cancelled leaves it open.

View

The form's client area.

public RDFormsFormView View { get; }

Property Value

RDFormsFormView

Methods

Assign(ComponentInstance, MethodDefinition, IReadOnlyList<FormValue?>, FormValue)

Assigns one of the properties that the window answers for a control of the form, as a program's code assigns it. Call it on the UI thread.

public void Assign(ComponentInstance component, MethodDefinition property, IReadOnlyList<FormValue?> arguments, FormValue value)

Parameters

component ComponentInstance

A component the form shows.

property MethodDefinition

The property: one of component's class's Methods that IsProperty.

arguments IReadOnlyList<FormValue?>

The property's arguments, as Invoke(ComponentInstance, MethodDefinition, IReadOnlyList<FormValue?>, CodeUnit) takes a method's, such as the index of List(Index).

value FormValue

The value assigned, of the property's type (Value): a number for a number, which the window rounds and checks as it does an argument, and for ItemIcon an object, as Invoke(ComponentInstance, MethodDefinition, IReadOnlyList<FormValue?>, CodeUnit) gives it.

Exceptions

ArgumentNullException

component, property or arguments is null.

ArgumentException

component is not shown on the form, or property is not a property of its class.

InvalidOperationException

The call is not on the UI thread.

FormErrorException

The assignment is refused with VB's error, and changes nothing: the errors of Invoke(ComponentInstance, MethodDefinition, IReadOnlyList<FormValue?>, CodeUnit) for the arguments and for the value, then 383 for a read-only property, and those of the list members (see Invoke(ComponentInstance, MethodDefinition, IReadOnlyList<FormValue?>, CodeUnit)).

Invoke(ComponentInstance, MethodDefinition, IReadOnlyList<FormValue?>, CodeUnit)

Runs one of the methods of the root or of a control of the form, or reads one of the properties the window answers, as a program's code calls it. Call it on the UI thread.

public FormValue Invoke(ComponentInstance component, MethodDefinition method, IReadOnlyList<FormValue?> arguments, CodeUnit unit = CodeUnit.Pixel)

Parameters

component ComponentInstance

The root, or a component the form shows.

method MethodDefinition

The method, or the property (IsProperty): one of component's class's Methods.

arguments IReadOnlyList<FormValue?>

The call's arguments, in the order of the method's parameters: null for an argument left out, and none past the last one given. A Variant parameter takes any value and the method coerces it; a parameter of another type takes a value of that type.

unit CodeUnit

The unit the code reads and writes positions and sizes in, which Move takes.

Returns

FormValue

The method's result, Empty for a method that returns none; or the property's value.

Remarks

Move sets Left, then Top, Width and Height, as many as it is given, in unit (see CodeUnits). It checks every value before it sets one: a negative size is error 5, and a value past a Long in twips is error 6. In VB6, a value is rounded to a whole twip, half to even. On the root, a Move that changes the size raises one Resize, where setting Width and then Height raises two.

SetFocus is error 5 while the window is not shown, and on a control that is hidden or disabled. Otherwise ActiveControl names the control at once, and the focus moves after the call returns, with the LostFocus of the control that had it, then the GotFocus of this one. Where another of the program's forms is the active one, this window is activated. A control that has the focus already raises nothing, and so does the root's SetFocus on the active form. SetFocus raises no Validate. A disabled or hidden container makes its controls refuse the focus, and the root's SetFocus activates a shown form that is not the active one: these two rules were not measured with VB6, and RDForms sets them.

ZOrder brings a control to the front of its plane in its container, for a Position of 0 or none, and sends it to the back for 1. A windowless control stays under every windowed one, and a container takes its controls with it. The position is an Integer, rounded half to even: another number is error 5, and a string that is not a number, or Null, is error 13.

Refresh draws the component and its contents again. On the root or a PictureBox whose AutoRedraw is False, it raises Paint inside the call. VB6's Refresh was not measured: RDForms sets this rule.

A Data control's UpdateRecord and UpdateControls are as UpdateRecord() and UpdateControls(): error 91, as the control opens no recordset.

A ListBox's and a ComboBox's list members are as RDFormsListBox and RDFormsComboBox run them: AddItem, RemoveItem and Clear return none, and a property that IsProperty returns its value (Assign(ComponentInstance, MethodDefinition, IReadOnlyList<FormValue?>, FormValue) assigns it). An index is an Integer, rounded half to even, and Null is error 94. AddItem is error 5 for an index outside 0 to ListCount, and RemoveItem for one outside the items; ItemData, ItemIcon and Selected are error 381 for an index outside the items, and List is "" there; ListIndex is error 380 for a value outside -1 to ListCount - 1. ItemIcon, an RD-VBA addition, is an object (FromObject(object?)): the bytes of the item's picture file, or Nothing. It is assigned one too: anything else is error 13, and a picture Inspect(byte[]?, out PictureInfo) refuses is error 481. ListIndex, ListCount, NewIndex and SelCount are Integers. Past 32767, a count or an index is a Long: RDForms sets this rule.

Exceptions

ArgumentNullException

component, method or arguments is null.

ArgumentException

component is neither the root nor shown on the form, or method is not a method of its class.

InvalidOperationException

The call is not on the UI thread.

FormErrorException

The call is refused with VB's error, and changes nothing:

  • 450 for too many arguments, 449 for a required one left out, 448 for one left out before one given;
  • 13 for a value that is not a number, 94 for Null where Move takes a number, and 6 for a number out of range;
  • 5 for a value the method refuses, and for SetFocus where nothing can take the focus;
  • 438 for a method of the class that the window does not run.

OnClosed(EventArgs)

Raises the Avalonia.Controls.TopLevel.Closed event.

protected override void OnClosed(EventArgs e)

Parameters

e EventArgs

The event args.

OnClosing(WindowClosingEventArgs)

Raises the Avalonia.Controls.Window.Closing event.

protected override void OnClosing(WindowClosingEventArgs e)

Parameters

e WindowClosingEventArgs

The event args.

Remarks

A type that derives from Avalonia.Controls.Window may override Avalonia.Controls.Window.OnClosing(Avalonia.Controls.WindowClosingEventArgs). The overridden method must call Avalonia.Controls.Window.OnClosing(Avalonia.Controls.WindowClosingEventArgs) on the base class if the Avalonia.Controls.Window.Closing event needs to be raised.

OnOpened(EventArgs)

Raises the Avalonia.Controls.TopLevel.Opened event.

protected override void OnOpened(EventArgs e)

Parameters

e EventArgs

The event args.

OnResized(WindowResizedEventArgs)

Raises the Avalonia.Controls.WindowBase.Resized event.

protected override void OnResized(WindowResizedEventArgs e)

Parameters

e WindowResizedEventArgs

An EventArgs that contains the event data.

PopupMenu(FormMenuItem, double?, double?, PopupMenuAlignment, FormMenuItem?)

Pops up the items of one of the form's menus, as VB's PopupMenu method does, at a point of the client area. The menu raises its Click as it opens, as it does on the bar, and an item chosen from it raises its own.

public Task PopupMenu(FormMenuItem menu, double? x = null, double? y = null, PopupMenuAlignment alignment = PopupMenuAlignment.Left, FormMenuItem? boldItem = null)

Parameters

menu FormMenuItem

The menu whose items pop up: a hidden top-level menu is the usual one.

x double?

The point's horizontal coordinate in the root's scale, or null for the pointer's.

y double?

The point's vertical coordinate in the root's scale, or null for the pointer's.

alignment PopupMenuAlignment

Where the menu goes across from the point.

boldItem FormMenuItem

An item of the menu, at any depth, to show in bold, as VB's BoldCommand argument, or null. An item that is not in the menu bolds none.

Returns

Task

A task that completes when the menu closes, after the Click of an item chosen from it. A menu that holds no items shows nothing and raises nothing, and the task returned has already completed.

Exceptions

ArgumentNullException

menu is null.

ArgumentException

menu is not one of the form's menus.

Unload()

Unloads the form as VB's Unload statement does: raises the root's QueryUnload, with an UnloadMode of 1, then its Unload, and closes the window unless a handler set Cancel.

public bool Unload()

Returns

bool

Whether the form unloaded: false where a handler cancelled, and where it is called from the root's own QueryUnload or Unload, which does nothing.