Calling MDI child code from MDI parent menu??? 
Author Message
 Calling MDI child code from MDI parent menu???



Quote:
>I am developing an MDI application which has several different flavours
>of child forms. When a particular child form is active I dynamically
>adjust the menus on the parent form to offer menus particular to each
>flavour of child form.

Hey?  Don't you just attach menus to each of the child forms?  These
menus then appear on the MDI parent in place of the parent's menu,
when the particular child is made active.  At least that's the way
it works in VB3.0.

Quote:
>However, when I then select one of these menu items, how can I kick
>some code in the active child form into life? I can of course use

(It is the code in the active child, if you do it as explained).
You may find it useful to put common menu item code into common
subroutines, which are then called within all the child menu
code blocks that are to have the same functionality.

--
Ken Tough                           Objective Technologies Ltd



Fri, 08 Jan 1999 03:00:00 GMT  
 Calling MDI child code from MDI parent menu???


Quote:
>Try fully qualifying what you want to activate:
>frmChild1.cmdButton1_Click

This will only work in VB 4.0, though.

--
VB Info: http://www.sn.no/~balchen/vb/visual.htm
FAQ: http://www.sn.no/~balchen/vb/faq.htm
Knowledge Base: http://www.sn.no/~balchen/vb/kb.htm



Fri, 08 Jan 1999 03:00:00 GMT  
 Calling MDI child code from MDI parent menu???

I am developing an MDI application which has several different flavours
of child forms. When a particular child form is active I dynamically
adjust the menus on the parent form to offer menus particular to each
flavour of child form.
However, when I then select one of these menu items, how can I kick
some code in the active child form into life? I can of course use
the ActiveForm property to identify the active child form but how can
I call code in that child form (which modifies that particular childs
form-level variables)?
I thought of moving the code to a global/public module but I still need
to pass the active child forms variables to the sub!

The only work around I could think of for the moment was to have a
Timer control on each child form (which CAN be accessed from the parent
forms code) which I could turn on/off dynamically to generate an event
to run the required code. This seemed a bit inelegant though.
Is there any  way to generate an event on a child form programmatically?



Fri, 08 Jan 1999 03:00:00 GMT  
 Calling MDI child code from MDI parent menu???

Quote:

>However, when I then select one of these menu items, how can I kick
>some code in the active child form into life? I can of

Martin,

Try fully qualifying what you want to activate:

frmChild1.cmdButton1_Click

Gary



Fri, 08 Jan 1999 03:00:00 GMT  
 Calling MDI child code from MDI parent menu???

Hey All!

HELP!!!

I'm working on an application where I would like to have a dynamic
number of tabs on a SSTab control.  Each of these tabs would be similar
(a frame control containing a dynamic list of Check boxes and probably
a button or two).  I'd been planning on having the frames as part of a
control array, loading them as needed at run time to build the tabs.
Anyway, the problem I'm running into is making the new frames actually
show up on the new tabs.  If I load the new frame control with the
first tab (index 0, where the frame array index 0 lives) the new one
shows up, but that's the only way I can ever see it.  Anyone have any
ideas?

Thanks in Advance!

Dave

=======================================================================

Vital Stats:
    Visual Basic 4.0 Professional 32 bit
    Developing under Win95 for Win95

Example code:
-------------

Sub CreateNewTab()

    Dim CurrentTabIndex as Integer

    CurrentTabIndex = SStab1.tabs

    'Create the new tab
    SStab1.tabs = SStab1.tabs + 1

    'Make the new tab the current tab
    SStab1.tab = CurrentTabIndex

    'Load a new frame
    '   I know this works, since I can set properties of the new      
    '   control
    Load Frame1(CurrentTabIndex)

    Frame1.Caption = "New Frame"

    'Show it (on the new tab?)
    '  It doesn't show up anywhere!
    Frame1.Visible

End Sub



Fri, 08 Jan 1999 03:00:00 GMT  
 Calling MDI child code from MDI parent menu???

And also make sure the subprocedure is declared as public.

Paul



Quote:

> >However, when I then select one of these menu items, how can I kick
> >some code in the active child form into life? I can of

> Martin,

> Try fully qualifying what you want to activate:

> frmChild1.cmdButton1_Click

> Gary



Sat, 09 Jan 1999 03:00:00 GMT  
 Calling MDI child code from MDI parent menu???



Quote:
>And also make sure the subprocedure is declared as public.

>Paul




>> >However, when I then select one of these menu items, how can I kick
>> >some code in the active child form into life? I can of

>> Martin,

Use Screen.ActiveForm.mnuTest_Click ...


Nice to meet you...



Sat, 09 Jan 1999 03:00:00 GMT  
 Calling MDI child code from MDI parent menu???


Quote:

>>Try fully qualifying what you want to activate:
>>frmChild1.cmdButton1_Click
>This will only work in VB 4.0, though.

Using VB3.0 it will work like this:

frmChild1.cmdButton1.Value = 1          ' Just "press" the key

waggy.

===============================================================
Wolfgang Wagner                        tel: +43 1 891-36/1391
                                       fax: +43 1 891-36/3317

Linke Wienzeile 192
A-1150 Vienna
===============================================================



Sun, 10 Jan 1999 03:00:00 GMT  
 Calling MDI child code from MDI parent menu???

Quote:

>I'm working on an application where I would like to have a dynamic
>number of tabs on a SSTab control.  Each of these tabs would be similar
>(a frame control containing a dynamic list of Check boxes and probably
>a button or two).  I'd been planning on having the frames as part of a
>control array, loading them as needed at run time to build the tabs.
>Anyway, the problem I'm running into is making the new frames actually
>show up on the new tabs.  If I load the new frame control with the
>first tab (index 0, where the frame array index 0 lives) the new one
>shows up, but that's the only way I can ever see it.  Anyone have any
>ideas?

Look into the API function call "SetParent"

(for reference, I highly recommend Dan Appleman's
_Visual_Basic_Programmer's_Guide_to_the_Windows_API_ [for 16bit]
_Visual_Basic_Programmer's_Guide_to_the_Win32_API_ [for 32bit])

It appears to me from a cursory look at what you've done
that the frames you're loading aren't _inside_ the SSTab,
though they may appear _on_top_of_ it.

     Bob O`Bob

-and be careful when you post an unrelated "followup" that you
 delete the data in the "References" header-
--



Tue, 12 Jan 1999 03:00:00 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. Modifying object in MDI Parent form from MDI Child form

2. Maximized MDI child form Covering Status bar on MDI parent

3. MDI Child to an MDI Parent

4. MDI Child to an MDI Parent

5. MDI Child to an MDI Parent

6. MDI Child to an MDI Parent

7. MDI Child to an MDI Parent

8. set the MDI parent of MDI child forms that are in a DLL

9. Accessing Objects on a Mdi Parent form from a Mdi Child form

10. Help: Change a MDI child's parent MDI form at run-time

11. MDI Child outside of MDI Parent?

12. Passing MDI Parents menu click events to child forms

 

 
Powered by phpBB® Forum Software