dynamic buttons on the form

|
programc++
|
Hi, I have a main form and 3 MDI child form. I have 6 different buttons altogether for the application. I need somhow to able to view 2 buttons at a time depending upon the child form opened. I can hide the buttons but I cannot display different button at the same location. Can anyone help me out with this..
Thanks in advance Mahendra Ghuge
|
Posted 17 years ago (Thread Starter)
|
|
About programc++ |
|
Membership pending.
Member subscribes to this thread but email is NOT VERIFIED.
Email Not Verified!
Once email is verified, we will review and approve the account.
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #10520, 6 replies
Thread Started 6/4/2004 11:24:00 AM
View Counter=3138
Last Reply Posted 6/7/2004 6:43:00 AM)
|
|
|
Location=-- USA
|
|
 |
|
Angel
|
Where are the buttons you are trying to hide and display? Are they on the main form or are they on different child forms?
If they are on the child forms, you should be able to use the onshow and onclose events of the child forms themselves to display and hide the relevant buttons. To hide and display the buttons, just set the visible property of each individual button to either true or false depending on whether you want the button to be seen or hidden.
|
Posted 17 years ago
|
|
About Angel |
|
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #10521 (Level 1.1)
Reply to 10520
Thread Started 6/7/2004 2:49:00 AM
View Counter=2
|
|
|
Location=England
|
|
 |
|
Angel
|
There are two ways of doing this. 1). Have six buttons on your main form and depending on which child form you display using your main menu options, display the two buttons you need and hide the other four using the visible property of the buttons (True/False). 2). Have just two buttons and declare a variable in your main forms public section. public WhichForm : String; { Public declarations } end; Whenever you call one of your child forms, set the variable. WhichForm := 'ChildForm1'; Then, in your two buttons, check your variable before cediding which procedure to run. i.e. if WhichForm = 'ChildForm1' then begin Do your procedure for child form1 end; if WhichForm = 'ChildForm2' then begin Do your procedure for child form2 end; if WhichForm = 'ChildForm3' then begin Do your procedure for child form3 end;
|
Posted 17 years ago
|
|
About Angel |
|
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #10523 (Level 1.2)
Reply to 10520
Reply Posted 6/7/2004 5:44:00 AM
|
|
|
Location=England
|
|
 |
|
Angel
|
I assume you mean that you are trying to place a second button on the same form, i.e. over the top of the first button. If this is the case, there is a BringToFront function for visual components, but I would be tempted to just change the caption of the button depending on what the user has selected. You could then use the buttons caption in the same way as a variable. So, in the buttons OnClick event you could have something like if Button1.Caption = 'Button1' then begin Do the button1 procedure end; if Button1.Caption = 'Button2' then begin Do whatever the button2 procedure was meant to do end;
|
Posted 17 years ago
|
|
About Angel |
|
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #10525 (Level 1.3)
Reply to 10520
Reply Posted 6/7/2004 6:28:00 AM
|
|
|
Location=England
|
|
 |
|
programc++
|
Hi, Let me explain you in more detail. I have 3 MDI child forms which are displayed depending upon the drop-down menu option on the Main form. For each MDI child form I have 2 buttons on the main form performing some operations. These operations are different for all 3MDI froms. So for each MDI form displayed there are 2 different buttons on the main form. any suggestion how to encounter this issue??
|
Posted 17 years ago (Thread Starter)
|
|
About programc++ |
|
Membership pending.
Member subscribes to this thread but email is NOT VERIFIED.
Email Not Verified!
Once email is verified, we will review and approve the account.
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #10522 (Level 1.4)
Reply to 10520
Reply Posted 6/7/2004 5:33:00 AM
|
|
|
Location=-- USA
|
|
 |
|
programc++
|
Hello, I had tried this before but there is a issue here. The location (X,Y) of a button. Suppose Button1 is on location (X,Y) for the child window 1. Now I need to hide this button1 for child window 2 and place a new button Button2 on the same location (X,Y). This doesnot seem to work. I can have the button on the different location coordinate but I am not able to place 2 buttons at the same location coordinate (X,Y).
|
Posted 17 years ago (Thread Starter)
|
|
About programc++ |
|
Membership pending.
Member subscribes to this thread but email is NOT VERIFIED.
Email Not Verified!
Once email is verified, we will review and approve the account.
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #10524 (Level 1.5)
Reply to 10520
Reply Posted 6/7/2004 5:56:00 AM
|
|
|
Location=-- USA
|
|
 |
Most Recent Post
|
programc++
|
Hi angel, That works fine .. thanks for your help
|
Posted 17 years ago (Thread Starter)
|
|
About programc++ |
|
Membership pending.
Member subscribes to this thread but email is NOT VERIFIED.
Email Not Verified!
Once email is verified, we will review and approve the account.
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #10526 (Level 1.6)
Reply to 10520
Reply Posted 6/7/2004 6:43:00 AM
|
|
|
Location=-- USA
|
|
Revive Thread!
Add a comment to revive this old thread and make this archived thread more useful.
Thread #10520 Counter |
3138 |
Since 4/2/2008
|
|
|