Production Delphi "Wizard"

xiaoxiao2021-03-06  44

[Crystal Studio Web] [Delphi] Utilizing the Delphi "Wizard" in many applications, using various "wizard" users can complete different operations. With an Form in Delphi, you can make a "wizard". Next, a simple example is explained below. 1. New project, this project contains two forms: Form1, Form2, corresponding unit name Leader.Pas, show.PAS. Use Form1 to create a "wizard", Form2 displays the generated components. 2. Add Panel1, Panel2, Panel3 on Form1, which is set to BSNONE, Panel2, and Panel3 Visible property set to false. Add Button1, Button2, Button3, button4, its CAPTION attribute is "Cancel", "Previous", "Next", "Complete", button2, button3, button, the enabled property is set to false. 3. Add Label1 first on Panel1, and its CAPTION property is "Step 1: Select Component Type". Add ListBox1, its items properties are TButton, Tedit, TPANEL. 4. Add Label2 first in Panel2, which is "Step 2: Define the position of the component". Add edit1, edit2, users use the Edit1, Edit2 input components, the left distances and upper margins. 5. Add Label3 first, its CAPTION attribute is "Step 3: Define the size of the component". Add edit3, edit4, users use Edit3, Edit4 input components. 6. Add the unit identifier show of Form2 in the USES clause of Form1. Add variable definitions in the Implementation section: var step: integer = 1, the variable STEP is used to represent the serial number of the current step. 7. Add stdctrls and extCtrls in the USES clause of Form2, which is the cell name of the unit where Panel, Button, and EDIT components are located; add USES clauses in the Implementation section: Uses Leader; 8. Write ListBox1 Onclick event. After selecting the component type, the "Next" button is activated, the code is as follows: button3.enabled: = true; 9. Write the "Next" button on the OnClick event: Procedure TFORM1.BUTTON3CLICK (Sender: TOBJECT); begin step: = (Step 1) MOD 3; if step = 0 Then Step: = 3; Case Step of 2: Begin // Go to Step 2 Panel2.visible: = true; // Make Panel2 in the forefront panel1.visible: = false; button2 .Enabled: = true; // Activates the "Previous" button end; 3: Begin // Go to step 3 panel3.visible: = true; // Make Panel3 appears in the front panel2.visible: = false; button3.enabled: = False; // Make the "Next" button invalid button4.enabled: = true; // Activate the "Complete" button end; end; end; 10. Write the "Previous" button on the "Previous" button according to the principle of step 8. 11. Write the "Cancel" button on the OnClick event.

转载请注明原文地址:https://www.9cbs.com/read-75577.html

New Post(0)