> My project shows that there are open and close events
> for a pushbutton.  Why would a pushbutton have these events?
> How does a pushbutton open or close?  Shouldn't code for these
> events be placed in the form opening or closing events?

I'm sure someone can answer this better than I can, but here goes...

Reasons you might place something in the Window Open event:
There might be times where you need to initialize certain things when the
window opens.  Filling arrays that will be accessed from different places
within the application might be one example.  Positioning the window might
be another.  Positioning and sizing controls that are on the window might be
another, especially if you are coding cross platform, or if you are moving
items off the window so that they cannont be seen (you should probably use
the "Visible" property for this).  For me, it generally seems to make sense
to place these items in the Window Open event.  Reading preference
information might also be another...

Reasons to place something in a control Open event:
Again, for me, it's a matter of what is logical for me in a given situation.
I might place code here if the code pertains only to this control or if it
isn't something repetitive like moving the item into a position.  Imagine
placing positioning code in the Open events of 50 controls.

Keep in mind that there are also timing issues.  The Open events don't fire
at the same time.  There are times when you might need something to fire
before something else.  This sort situation can cause issues because the
order of events can be different depending on which OS you are running your
application.

For me, it's simply a matter of what is logical and/or convenient for me.


The Language Reference:
>From the Language Reference (RB5.5.5), under Control, Events:
Close -- The Window is about to close.
Open -- The window is about to close.

Under Methods you will see that there is no Open method, yet there is a
Close method.  Calling PushButton.Close will close the PushButton.  Since
there is no Open method, you cannot "Open" the PushButton control by coding
PushButton1.Open.


> I cannot find an application startup property in online
> help that positions the default window on the screen.  
> How is startup position accomplished?

The 'startup' property is the Open event of the window.  This is where you
would more than likely want to place you positioning code.  You can also
place position code in the App Open event, though I rarely find a need to
place this sort of code in the App.

Open event of Window1:
  Me.Left = 250
  Me.Top = 180

Open event of App:
  Window1.Left = 250
  Window1.Top = 180

>From the Action event of a PushButton control on the window (self is a
refeence to the control's parent):
  Self.Left = 250
  Self.Top = 180

HTH and hope I didn't share too many falsehoods.  I'm sure someone will
point them out if I have :)



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to