Unit CastleDialogViews
Description
Dialog boxes (to display some information, or ask user for confirmation, or ask user to input a simple value) expressed as user-interface views (TCastleView). This unit defines the classes (TCastleView descendants) to display given dialogs.
These views work on all platforms, including iOS and web (where the modal routines from CastleMessages unit don't work, as the browser and iOS must control the main loop).
Instantiate these views and organize your whole application using TCastleView classes. See https://castle-engine.io/views about how to use TCastleView. Like this:
type TMyGameView = class(TCastleView) private DialogAskDeleteFile: TViewDialogYesNo; public function Press(const Event: TInputPressRelease): boolean; override; procedure Resume; override; end; function TMyGameView.Press(const Event: TInputPressRelease): boolean; override; begin Result := inherited; if Result then Exit; if Event.IsKey(keyEnter) then begin DialogAskDeleteFile := TViewDialogYesNo.Create(Self); DialogAskDeleteFile.Caption := 'Are you sure you want to delete this file?'; Container.PushView(DialogAskDeleteFile); end; end; procedure TMyGameView.Resume; begin inherited; if DialogAskDeleteFile <> nil then // returning from DialogAskDeleteFile begin if DialogAskDeleteFile.Answer then DeleteFile(...); FreeAndNil(DialogAskDeleteFile); end; end;
Source: ui/castledialogviews.pas (line 66).
Uses
- Classes
- Math
- CastleGLUtils
- CastleUtils
- CastleImages
- CastleStringUtils
- CastleVectors
- CastleKeysMouse
- CastleControls
- CastleRectangles
- CastleColors
- CastleUIControls
- CastleFonts
- CastleInternalRichText
- CastleTimeUtils
Overview
Classes, Interfaces, Objects and Records
| Name | Description |
|---|---|
Class TViewDialog |
Abstract class for a modal dialog user-interface view. |
Class TViewDialogOK |
Wait for simple confirmation ("OK") from user. |
Class TViewDialogYesNo |
Ask user a simple "yes" / "no" question. |
Class TViewDialogChoice |
Ask user to choose from a number of options. |
Class TViewDialogInput |
Ask user to input a string, or cancel. |
Class TViewDialogKey |
Ask user a press any key, and return this key. |
Class TViewDialogPressEvent |
Ask user a press anything (key, mouse button, mouse wheel), for example to configure a keybinding for a game. |
Generated by PasDoc 0.17.0.snapshot.