Jumat, 07 Maret 2014

RE: [MS_AccessPros] Wrapper for procedure call with optional arguments

 

Thanks John,

You have 'unstuck' me.

Glenn

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of John Viescas
Sent: Friday, March 7, 2014 10:38 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Wrapper for procedure call with optional
arguments

Glenn-

Check for IsMissing and substitute the current values if true.

Dim lngTop As Long, lngWidth As Long, lngHeight As Long

If IsMissing(Top) Then
lngTop = oMyForm.Form.WindowTop
Else
lngTop = Top
End If

. etc.

oMyForm.Move Left, lngTop, lngWidth, lngHeight

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

On Mar 7, 2014, at 4:17 PM, Glenn Lloyd <argeedblu@gmail.com> wrote:

> I am trying to write a wrapper that calls a form's move method. That
> method takes one required and three optional arguments:
>
>
>
> Move(Left, Optional Top, Optional Width, Optional Height)
>
>
>
> This is in the context of a class that has a form as one of its members.
>
>
>
> Let's say I have instantiated an object of this class as oMyForm.
> Right now I can move the form this way
>
>
>
> oMyForm.Form.move xxx, [yyy], [www],[ hhh]
>
>
>
> I am writing the wrapper so that the call will look like this
>
>
>
> oMyForm.move xxx, [yyy], [www],[ hhh]
>
>
>
> This is what I have so far in the class. Mfrm is th internal private
> form variable
>
>
>
> Public Sub Move(Left As Long, Optional Top As Variant, Optional Width
> As Variant, Optional Height As Variant)
>
> ' Procedure: move
>
> ' DateTime: 3/7/2014 9:51:46 AM
>
> ' Author: Glenn Lloyd
>
> ' Description: call the form's move method to position it
>
> '--
>
>
>
> Const cstrProcedure = "move"
>
> On Error GoTo HandleError
>
>
>
> 100 mfrm.Move Left
>
> 'what if the call includes one or more of the optional arguments
>
> HandleExit:
>
>
>
> Exit Sub
>
>
>
> HandleError:
>
> ErrorHandle Err, Erl(), cstrModule & "." & cstrProcedure
>
> Resume HandleExit
>
> End Sub
>
>
>
> I am stuck at the line that I have labeled 100. How do I respond to
> the various possible combinations of the optional arguments?
>
>
>
>
>
> Glenn Lloyd
>
> Sudbury Training
>
> (705)805-6712 | Fax (705)805-805-0696| Text (705)885-5283
>
> www.SudburyTraining.com <http://www.sudburytraining.com/>
>
>
>
> LogoHoriz
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo Groups Links
>
>
>
>

------------------------------------

Yahoo Groups Links

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
.

__,_._,___

Tidak ada komentar:

Posting Komentar