Replace RadioButton with ComboBox with 2 items (insert into listbox, insert into memo - without an option to input a text). Mem1.ReadOnly := chkReadOnlyMemo.Checked Procedure TForm1.chkReadOnlyMemoClick(Sender: TObject) Now we just add code for CheckBox which is nothing really difficult: Once done that, the text in TEdit will be erased. Procedure TForm1.btnAddClick(Sender: TObject) Īfter pressing a button, the text will be added into the selected component. Into the body of OnClick event insert this code: We can now - using these several components - actually create something useful. If csDropDown is set as a style, the inputed text is saved in property Text. Items are saved in property ItemsĪ chosen property is set by property ItemIndex where -1 means nothing is selected and 0 means the first item. Property Style determines whether user can input a text (csDropDown) or not (csDropDownList). This component allows users to pick an option from a scroll list or to input a text (if it’s enabled). Looks similar to TMemo but a whole line is always chosen (index of a chosen line is in ItemIndex - only while running). HideSelection hides selection if a component isn’t active (it doesn’t have a focus). WordWrap sets whether a text will be put on another line if it extends the current line. Scrollbars sets the visibility of scrollbars. Lines are saved in a property Lines which allows their saving and loading. Similar to TEdit but operates with more lines. Ideally use component TGroupBox which has a title and a frame which can be seen in a picture below where you can as well see difference between TRadioButton and TCheckBox (more options can be chosen within a group). If we put two panels on a form and on both we put several TRadioButtons, then only the ones within the same panel can influence each other. That applies to all TRadioButtons of one owner (for example on a form or on a panel). Warning: TRadioButton automatically checks that only one is selected. That is set via property State.Īllows users to choose one option out of several ones. Autosize dynamically determines and sets the width based on the length of a text.Īllows users to choose from 2 options YES or NO (property Checked) or 3 options. If & sign is in a caption, the following letter will be used an accelerator (if Windows allows that), that is, after pressing ALT + key, that component will be given a focus. This property show the component which will get a focus in case of clicking on a label. This component is - generally - used for showing a text. If you enable PasswordChar, a component will be used for a password input. It’s used for inputing a line-long text, for example a password. ModalResult - after pressing it returns this value to a called dialog Both ways call OnClick event and a programmer can do something.Ĭancel and Default set a button as either ESC (Cancel) or Enter (Default). User can left-click on it or he can select it using TAB key and confirm using Spacebar. Font.Color - a color of a component’s font.Color - a color of a component (background).Left, Top, Width, Height - a position and a size of a component. BevelInner, BevelOuter, BevelWidth, BevelKind - a frame (line) around the component.Cursor - change the mouse cursor if it's above a component.Align - aligning the component, several options, for example alNone (no aligning).Font and ParentFont - font for a component, if ParentFont is set, it has a priority over Font.ReadOnly - determines whether the data can be edited (compared to Enabled, the text can be selected for example by mouse).TabOrder and TabStop - determines whether a component can be selected by TAB key (TabStop) and its position in selection.Text and Caption - the main text or the caption of the component (depends on the type).Enabled - enables and disables the component.Let’s mention the basic ones.Īt the picture you may see several basic components:īecause every single component comes from a general basis, they share some common properties (to be precise, most of them). We have two types of components: visual (the ones users can see such as TButton) and non-visual (the ones which users cannot see - such as TOpenDialog). VCL (Visual Component Library) is a stable part of Delphi. Delphi Programming for Beginners - Lesson 3 Basic Components
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |