class initialize

class initialize

Anonymous
Not applicable
305 Views
4 Replies
Message 1 of 5

class initialize

Anonymous
Not applicable
is this the wrong place to ask for user input?
the class worked till i moved the user input from the test sub that created
the class into the class initialize event
but not sure why?

'''''''start class
Private Sub Class_Initialize()
''''''''''' set direction '''''''''''''
'mWeldDir = "Left"
Dim vchoice As String
vchoice = "Left Right"
Dim doc As AcadDocument
Set doc = ThisDrawing

doc.Utility.InitializeUserInput 0, vchoice
Dim ans As String

ans = doc.Utility.Getkword("Enter weld direction")
'Debug.Print "Answser was: " & ans
mWeldDir = ans
0 Likes
306 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Mark Propst wrote:
> is this the wrong place to ask for user input?
> the class worked till i moved the user input from the test sub that
> created the class into the class initialize event
> but not sure why?

The Intialize event is used to establish the initial state of your
object. At this point, it's still under construction so it's best not to
require user interaction.

--
"It's more important that you know how to find the answer than to have
the answer." - Me
0 Likes
Message 3 of 5

Anonymous
Not applicable
ok I found my error .... getkword instead of GetKeyWord
dam* lisp on the brain!

so it works in initialize ok, but you're saying not to use it that way!?!
so I want to set all vars(in the sub that calls the class) that involve user
choice before calling the class?

is it correct to set all member variables to their default value in the
initialize sub? (that don't require user choice)
or what should go there?
thanks
Mark

"Frank Oquendo" wrote in message
news:F5D5BA848D59F2FDA8D7A3B8F6D1E113@in.WebX.maYIadrTaRb...
> Mark Propst wrote:
> > is this the wrong place to ask for user input?
> > the class worked till i moved the user input from the test sub that
> > created the class into the class initialize event
> > but not sure why?
>
> The Intialize event is used to establish the initial state of your
> object. At this point, it's still under construction so it's best not to
> require user interaction.
>
> --
> "It's more important that you know how to find the answer than to have
> the answer." - Me
>
>
0 Likes
Message 4 of 5

Anonymous
Not applicable
Hi Mark,
Your class should initialize to a default state and the initialize event is
the place to set the member fields to a default value. If you want to
change those values, create a property or method to do so. As Frank said,
the Initialize event isn't really the best place to ask for user input.
--
Bobby C. Jones
www.AcadX.com

"Mark Propst" wrote in message
news:1295707B65F276C1A277C7C64FAFF149@in.WebX.maYIadrTaRb...
> ok I found my error .... getkword instead of GetKeyWord
> dam* lisp on the brain!
>
> so it works in initialize ok, but you're saying not to use it that way!?!
> so I want to set all vars(in the sub that calls the class) that involve
user
> choice before calling the class?
>
> is it correct to set all member variables to their default value in the
> initialize sub? (that don't require user choice)
> or what should go there?
> thanks
> Mark
>
> "Frank Oquendo" wrote in message
> news:F5D5BA848D59F2FDA8D7A3B8F6D1E113@in.WebX.maYIadrTaRb...
> > Mark Propst wrote:
> > > is this the wrong place to ask for user input?
> > > the class worked till i moved the user input from the test sub that
> > > created the class into the class initialize event
> > > but not sure why?
> >
> > The Intialize event is used to establish the initial state of your
> > object. At this point, it's still under construction so it's best not to
> > require user interaction.
> >
> > --
> > "It's more important that you know how to find the answer than to have
> > the answer." - Me
> >
> >
>
>
0 Likes
Message 5 of 5

Anonymous
Not applicable
It goes both ways at times too.
*on error* doesn't want to work in lisp 🙂
Murph

"Mark Propst" <> wrote in message ...
> ok I found my error .... getkword instead of GetKeyWord
> dam* lisp on the brain!
>
>
0 Likes