Re: mdi client problems - second try

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: tsiGeorge (molly_at_community.nospam)
Date: 01/01/05


Date: Sat, 1 Jan 2005 15:47:01 -0800

Problem 1. I've tried form.Activate. Here is what happens: Activated fires;
the txtBox.focus is executed; Entered fires and I set the backcolor to blue
and the forecolor to white; Leave fires and I set the colors back to
white/black. If I put a break point at the txtBox.focus command and step it
thru the focus is in txtBox with colors set blue/white (but wait the Leave
fired and the colors should be white/black). If I remove the breakpoint the
focus is not in the txtBox and the colors are white/black. There seems to be
a problem with one window becoming invisible and another becoming visible.
Maybe my 10ms timer lets things settle down. Any other suggestions?

Problem 2.

Tried your suggestions. Not any better than child.Dock = DockStyle.Fill and
doesn't position the window correctly (you still need to dock it or
something) and is still not maximized. Is there anyway of "clicking" the
restore box by code?

"Robby" wrote:

>
> For the first problem. What could be happening is that the MDI child does
> not have focus when it is made visible. After you set Form.Visible = True
> call Form.Activate. This will set the form as the active MDI child and give
> it focus. Then your call to TextBox.Focus will set the focus to the control
> as required.
>
> For the second problem. One solution is to reset the minimum size of the
> MDI children to the MDI parent's ClientSize each time the MDI parent is
> resized. This will dynamically resize the MDI children along with the
> parent as needed.
>
> Hope this helps.
>
> Robby
>
> "tsiGeorge" <molly@community.nospam> wrote in message
> news:45BD2190-2259-43B3-9D75-24AD23A1D56A@microsoft.com...
> > In our app (VB) client forms are displayed based on what is on the current
> > client form and the button pressed. A user never selects a client form.
> > You
> > can think of this process as filling out a very long form with many
> > branches
> > (e.g., IRS form 1040). Once a client form is loaded it is never unloaded -
> > just hidden.
> >
> > I need help resolving these 2 problems:
> >
> > 1) Focus on a text box. I know i can't set the focus in the Load event but
> > the Activated event only fires when the first client loads. Also, when the
> > form is redisplayed (i.e., made visible) txtbox.focus, for example,
> > doesn't
> > work. What I do now is start a timer with a 10ms interval and set the
> > focus
> > in the timer event. I also think that sometimes when I leave the text box
> > the
> > Leave event doesn't always fire. There's got to be a better way.
> >
> > 2) Client form size. I would like the client form to be the maximum size
> > that will fit in the MDI parent. The minimum size of the client forms is
> > set
> > to 720 X 540. If i set the WindowState to Maximized the first client is
> > displayed maximized but all the others are displayed at their minimum
> > size.
> > When the first client form is redisplayed it is also displayed at the
> > minimum
> > size. This just drives the users crazy. What I've done is after showing
> > the
> > form the first time or making the form visible on redisplays I set the
> > child.Dock = DockStyle.Fill. I also do this if the
> > parent is resized. Now the client is almost maximum size except it still
> > has
> > its own margins.
> > --
> > tsiGeorge
>
>
>



Relevant Pages

  • Re: disable restore contorl for mdi child forms
    ... form in maximized state it has restore control button and i ... so that client can not restore the mdi child form can any ... thanx Michael but I can't do any thing this what the client requires ... an MDI form and you want a child forms to always completely fill the MDI ...
    (microsoft.public.vb.general.discussion)
  • Re: MDI problem
    ... frame window. ... Your MDI children will occupy the remaining client ... The problem is that the Client area of an MDI Parent Form /does/ act ...
    (alt.comp.lang.borland-delphi)
  • Re: Events in a console app
    ... but for instance OnClientConnect never fires, ... in console apps - no windows messages of course, ... It does have an internal notification, but it relies on receiving a message from the OS. ...
    (comp.lang.pascal.delphi.misc)
  • Re: MDI problem
    ... frame window. ... Your MDI children will occupy the remaining client ... like wallpaper - very aggressive wallpaper that forces controls on it ...
    (alt.comp.lang.borland-delphi)
  • RE: problems with restoring minimized MDI child forms
    ... In Windows MDI application, its MDI child windows is managed by the MDI ... grayed background color control filling the MDI parent's client area). ... Normally for MDI child window, we should manipuate them through sending MDI ...
    (microsoft.public.dotnet.framework.windowsforms)