Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Toolbar with Mdichilds

Posted on 2000-04-19
5
Medium Priority
?
252 Views
Last Modified: 2010-05-02
yeah let me first of all thank u for trying to answer my question.
u know i'm  using a toolbar for my project and a single toolbar is used for all the mdichilds.However i want my toolbar to be independent upon waht form is open.in other words if form A modifies the toolbar.Form B ,when activated should not see the toolbar affected.u see what i mean.
it is as if each form has its own toolbar.plz help me 'cause i have to return my project in 6 days.please help.Thanx in advance
0
Comment
Question by:yarroo
  • 3
5 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2733531
in each form's activate event, just code in which elements of the toolbar should be visible to that particular form.  If FormA changes a caption from one word to another then when FormB is activated just set it back to its original value (or to whatever special value it should have for FormB), and just repeat for each element of the toolbar that each from needs/requires.
0
 

Author Comment

by:yarroo
ID: 2733582
i would like to say something much clearer
if a user clicks on button new then it is apparent that delete is disabled 'cause u cannot delete document which has not yet been created.so delete is disabled.
suppose now i open another form for viewing.in this case delete should be enabled to allow me to delete an existing transaction.what if i come back to the previous loaded form.i should see delete still a disabled button.how can i do this.plz help
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2733594
in each form create a boolean variable.  say FormA is the form you just selected new from. At the top of FormA:

Option Explicit
Dim showDelete As Boolean

In FormA's load event set showDelete = False (since theres nothing there yet)
and the button for delete to disabled.

Private Sub Form_Load()
   showDelete = False
   btnDelete.Enabled = False
   etc...
End Sub


Now once you create a document that allows for it to be deletable, you set btnDelete.Enabled = True as well as showDelete = True.

Now in your FormA's activate event, you check your boolean variable.

Private Sub Form_Activate()
  If showDelete = True Then
     btnDelete.Enabled = True
  Else
     btnDelete.Enabled = False
  End If
End Sub

you will do this for each item that is in question.  create a boolean variable for it and check these boolean variables upon activating the forms.
0
 
LVL 1

Accepted Solution

by:
prakashbitra earned 225 total points
ID: 2735334
hi yarroo! this answer may help u to complete ur project in time.

create a tool bar with fixed tool box style and place this window in a specified position by using .top and .left properties.

use tag values of FormA, FormB forms as the key to the too bar window. on every form load assign the form tag value to a Public variable say varTag.

use this varTag variable in the tool bar window.
say for example if u have New , Edit and Delete buttons are existing in the tool bar window.

on clicking the New button in the tool bar on click event use the sample code as follows :
if varTag = "FormA" then
        do statments for FormA form
else do some statements

simple..

bye
happy working..
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2735395
prakash the question is how to keep the toolbars properties independent and specific to a particular form, not how to tell the program which form will be affected by clicking on a button.  Obviously the form with the focus should receive the input.  The main question proposed was how to keep track of a form's particular instance of the toolbar.  Also when you start off a comment like "this may help you", then just post a comment. Actually you should always just post comments especially when there have already been comments made to aid the questioner.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question