[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference abbott::visual_basic

Title:Microsoft Visual Basic
Moderator:TAMARA::DFEDOR::fedor
Created:Thu May 02 1991
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2565
Total number of notes:10453

2519.0. "Opening a full screen form" by LEXSS1::GINGER (Ron Ginger) Wed Mar 19 1997 09:07

    I want a form to open as full screen. I set its window prop to be
    maximized, and the form does open full screen. Next I want to size some
    of my frames and controls in proportion to the large window. 
    
    I tried getting the screen size with
    
    SCREENWIDTH= Me.width
    SCREENHEIGHT = Me.height
    
    then using this to set various height/width properties. If I put the
    code in either Form_initialize or Form_open, the width value returned
    is the one set at design time.
    
    If I put the commands into a Command_click procedure, let the window
    open with all the controls as design size, then running the
    Command_clik does what I want.
    
    I guess this is a probelm of timing, when the form is being loaded it
    doesnt yet have the full screen size?
    
    What is the right way to do this? 
T.RTitleUserPersonal
Name
DateLines
2519.1AXEL::FOLEYhttp://axel.zko.dec.comWed Mar 19 1997 12:006

	You might want to see about getting a control that does this
	for you.

							mike
2519.2LEXSS1::GINGERRon GingerWed Mar 19 1997 15:446
    >You might want to see about getting a control that does this
            for you.
    
    
    any examples of such a control, or sources?
    
2519.3Try SCREEN.WIDTH and SCREEN.HEIGHTMRSERV::PETERSWed Mar 19 1997 16:4311
    Since you mention wanting the "screen size", why not use the
    expressions SCREEN.WIDTH and SCREEN.HEIGHT? But note they give you the
    true screen dimensions, where Me.width and Me.height will give you
    the form dimensions. In your case, with the form maximized, these will
    be the same.
    
    My typical use for these sets of values is for centering a form on
    the screen.
    
    Don
    
2519.4LEXSS1::GINGERRon GingerThu Mar 20 1997 09:2810
    thanks, Ill look at screen.width.
    
    I am curious as to why the me.height is incorrect at the time a
    form_load sub runs. Is there any good description of the exact sequence
    of events for this? When do the general declarations of a form get
    processed? I assume they must be done before a form_initialize sothat
    variables declared will be ready.
    
    Related to form opening, I notice that the defalt form name comes up as
    Form1, yet the default sub is Form_load, not Form1_load. Why is this? 
2519.5Multiple resize callsTURRIS::twuwuv.zko.dec.com::howerThu Mar 20 1997 10:316
Well, I've noticed that form_resize gets called several times before 
the form actually gets displayed - and the scaleXXX properties are 
slightly different every time. Never got the chance to investigate what 
was actually going on, but it may be related to design time/display 
time size updating. Might be worth checking?
		Helen
2519.6AXEL::FOLEYhttp://axel.zko.dec.comThu Mar 20 1997 10:328

RE: .2

	I think Sheridan or some of the other popular control
	makers have something.

							mike
2519.7MIASYS::HETRICKThu Mar 20 1997 12:405
     Re: .0

	  The resize event is probably the one you want.

				     Brian
2519.8form doesn't display until Load even completesPGREEN::HAYESIIs that a warp nacelle in your pocket...?Mon Mar 24 1997 09:3311
    If I recall, the Form-Load event completes (normally) before the form
    actually displays. IN this case, I would guess that the 'maximise'
    process doesn't occur until just before the form displays hence the
    hight and width properties won't be updated until after the Form_Load
    completes.
    
    You can force the form to display early by using the Show method (can't
    remember if you need a DoEvents as well).
    
    Cheers
    Ian.
2519.9XSTACY::PATTISONA rolling stone gets the wormMon Mar 24 1997 13:026
Putting the code in Form_Resize instead of Form_Initialize should
get round the problem. The resize event always gets called when a
form is displayed for the first time.

Dave