Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

Toolbar with Mdichilds

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
yarroo
Asked:
yarroo
  • 3
1 Solution
 
AzraSoundCommented:
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
 
yarrooAuthor Commented:
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
 
AzraSoundCommented:
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
 
prakashbitraCommented:
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
 
AzraSoundCommented:
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now