I.T. Discussion Community!
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

July Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi VCL Topic   Print This     

dynamic buttons on the form

dynamic buttons on the form in Delphi VCL topic (part of our Pascal and Delphi Coding group).

Quick Search: dynamic   buttons   dynamic buttons   dynamic buttons form  
programc++
-- USA
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 16 years ago (Thread Starter)
Comment Quote
About programc++ -Collapse +Expand
Visit Profile
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=3115
Last Reply Posted 6/7/2004 6:43:00 AM)
Location=-- USA 
Joined=16 years ago   MB Posts=14  
Angel
 (Inactive)
England
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 16 years ago
Comment Quote
About Angel -Collapse +Expand
Visit Profile
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  
Joined=19 years ago   MB Posts=199  
Angel
 (Inactive)
England
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 16 years ago
Comment Quote
About Angel -Collapse +Expand
Visit Profile
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  
Joined=19 years ago   MB Posts=199  
Angel
 (Inactive)
England
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 16 years ago
Comment Quote
About Angel -Collapse +Expand
Visit Profile
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  
Joined=19 years ago   MB Posts=199  
programc++
-- USA
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 16 years ago (Thread Starter)
Comment Quote
About programc++ -Collapse +Expand
Visit Profile
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 
Joined=16 years ago   MB Posts=14  
programc++
-- USA
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 16 years ago (Thread Starter)
Comment Quote
About programc++ -Collapse +Expand
Visit Profile
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 
Joined=16 years ago   MB Posts=14  
Most Recent Post
programc++
-- USA
Hi angel,
That works fine .. thanks for your help
 Posted 16 years ago (Thread Starter)
Comment Quote
About programc++ -Collapse +Expand
Visit Profile
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 
Joined=16 years ago   MB Posts=14  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P195A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #10520 Counter
3115
Since 4/2/2008

Follow PrestwoodBoards on: 


©1995-2020 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech