irigsoft Posted April 27, 2016 Posted April 27, 2016 Hello, Sorry for this question but I am New in this. I test last version on UniGui and I have a question: I create one Form dynamically with some controls: Steps : Create Form - is TMdiChild on MainForm. BorderStyle= bsNone Create TGroupBox.PArent = Form Create Panel.Parent = Form Create TGroupBox.Button1.Visible = True Create TGroupBox.Button2.Visible = False Form.Show when I work on This way Button2 is visible but no OnClick fire. I think Button2 is Visible=False but is Visible on Form. Is this a BUG or I somewhere wrong 10x Quote
Sherzod Posted April 27, 2016 Posted April 27, 2016 Hi, Welcome to our wonderful UniGUI Forum! Can you try analyze the demo projects?!, including: C:\Program Files (x86)\FMSoft\Framework\uniGUI\Demos\Desktop\Dynamic Best regards. Quote
irigsoft Posted April 27, 2016 Author Posted April 27, 2016 Hi, tank you for this. But my problem is still here. I will explain: Can I do this? 1. Create Form1 2. Create Button like this: TUniButton(InsertControl(TUniButton.Create(Self))) , Self=Form1 3. Create TUniPanel (InsertControl(TUniPanel.Create(Self))) 4. Set Panel.Name = 'TestPanel' 5. Set Button.Parent = TestPanel I try to create "button" with parent "TestPanel" with parent "Form1", how can do this Quote
Sherzod Posted April 27, 2016 Posted April 27, 2016 For example, try: procedure bClick(Sender: TObject); procedure TMainForm.bClick(Sender: TObject); begin ShowMessage('Click'); end; procedure TMainForm.UniButton1Click(Sender: TObject); var C: TWinControl; begin C := TUniPanel.Create(Self); with TUniPanel(InsertControl(C)) do begin Left:=70; Top:=48; end; with TUniButton(InsertControl(TUniButton.Create(Self))) do begin Parent := C; Left:=70; Top:=48; Font.Style:=[fsBold]; Font.Color:=clGreen; Caption:='Click!'; OnClick:=bClick; end; end; Quote
irigsoft Posted April 27, 2016 Author Posted April 27, 2016 How You create a new form "Form1" Form1 is mdiChild Form of mainForm (mdiForm), Testpanel is child of Form1, and button is child of Testpanel after that Button.Visible = False. I explain my idea. I Have Desktop application. Create MasterForm as mdiForm, after that i dynamically create various forms as MDIChild of MasterForm. On Screen (MasterForm) always is visible one mdiChild form, she can have diffеrent controls: Panels, button, labels and so on some of this controls are Visible=False, other are Visible=True. Now, i want to bild Web application like this idea. I use Mainform as mdiForm (MasterForm), she have one button.OnClick - create new form mdiChild and all components on mdiChild Form. When is use Your example all components go to the MasterForm, but I want to be in mdiChild Form. Quote
irigsoft Posted April 28, 2016 Author Posted April 28, 2016 Thank you for help. Now is work perfect Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.