Prev: Graphic Draw Question
Next: Redirection
From: MM on 2 Mar 2010 19:01 On Tue, 02 Mar 2010 12:45:12 -0800, Karl E. Peterson <karl(a)exmvps.org> wrote: >MM wrote: >>> AnyProc Controls(.Name) >> >> Ah, I tried everything else, but not that! > >Will that work with a control array member? > >> Don't you think a ".Self" property would have been useful? Like Me. > >I think This would have been a good way to refer to whatever With is >refering to. That way, it's not an extension of the object itself. Yeah, I like it! AnyProc .This That looks really cool. MM
From: MM on 2 Mar 2010 19:03 On Tue, 2 Mar 2010 15:48:41 -0500, "Nobody" <nobody(a)nobody.com> wrote: >"MM" <kylix_is(a)yahoo.co.uk> wrote in message >news:1ntqo51hoeruepvockkk3hqdt52vmhtbet(a)4ax.com... >> Ah, I tried everything else, but not that! >> >> Don't you think a ".Self" property would have been useful? Like Me. > >Man, that would be too much OOP! :-) Don't worry! I can take it in small doses, like cod liver oil. >Personally I don't use With, it makes it harder to find variables such as >"MyUDT.var1". Looks really neat, though. I can't recall having a problem finding stuff later. If need be I fire up WinGrep on the raw text files (.frm, ..bas etc) MM
From: MM on 2 Mar 2010 19:05 On Tue, 2 Mar 2010 21:46:59 +0100, "Helmut Meukel" <NoSpam(a)NoProvider.de> wrote: > >"MM" <kylix_is(a)yahoo.co.uk> schrieb im Newsbeitrag >news:h9iqo5pens21lrjljqfqpjgfi8at2p3ad2(a)4ax.com... >> Suppose I have: >> >> Sub AnyProc (cbo as ComboBox) >> MsgBox cbo.Name >> End Sub >> >> With Combo1 >> AnyProc ? >> End With >> >> How can I refer to the object itself to pass to AnyProc? What I need >> is a .Self property! >> >> MM > >Hmm, > >I think it can be done. I wouldn't do this in my own code, but... >How about: > Sub AnyProc (ctl as Control) > MsgBox ctl.Name > End Sub > > With Combo1 > .SetFocus > AnyProc me.ActiveControl > End With No, no! I may not want it to have focus right then! >I would rather write the control's name in my code, >but the above will do the trick. >However setting the focus to another control might irritate >the user, Indeed. MM
From: Karl E. Peterson on 2 Mar 2010 19:48 MM wrote: > On Tue, 02 Mar 2010 12:45:12 -0800, Karl E. Peterson <karl(a)exmvps.org> > wrote: > >> MM wrote: >>>> AnyProc Controls(.Name) >>> >>> Ah, I tried everything else, but not that! >> >> Will that work with a control array member? >> >>> Don't you think a ".Self" property would have been useful? Like Me. >> >> I think This would have been a good way to refer to whatever With is >> refering to. That way, it's not an extension of the object itself. > > Yeah, I like it! > > AnyProc .This > > That looks really cool. Ditch the leading dot. This would be like Me, but it would refer to one of two things. Within a With block, to whatever object has currency. Or, outside a With block, but within an Event procedure, to the object that's raising the event. How's that sound? So, in your case, you could do: With Combo1 AnyProc This End With Or, ... Private Sub Combo1_Change() AnyProc This End Sub Makes too much sense, I suppose. At least to me. I'm sure someone can pick holes in it? -- ..NET: It's About Trust! http://vfred.mvps.org
From: MM on 3 Mar 2010 03:40
On Tue, 02 Mar 2010 16:48:41 -0800, Karl E. Peterson <karl(a)exmvps.org> wrote: >MM wrote: >> On Tue, 02 Mar 2010 12:45:12 -0800, Karl E. Peterson <karl(a)exmvps.org> >> wrote: >> >>> MM wrote: >>>>> AnyProc Controls(.Name) >>>> >>>> Ah, I tried everything else, but not that! >>> >>> Will that work with a control array member? >>> >>>> Don't you think a ".Self" property would have been useful? Like Me. >>> >>> I think This would have been a good way to refer to whatever With is >>> refering to. That way, it's not an extension of the object itself. >> >> Yeah, I like it! >> >> AnyProc .This >> >> That looks really cool. > >Ditch the leading dot. This would be like Me, but it would refer to >one of two things. Within a With block, to whatever object has >currency. Or, outside a With block, but within an Event procedure, to >the object that's raising the event. How's that sound? Yeah, I'd accept that. However, MS won't be implementing it any time soon. In fact, never. > So, in your >case, you could do: > > With Combo1 > AnyProc This > End With > >Or, ... > > Private Sub Combo1_Change() > AnyProc This > End Sub > >Makes too much sense, I suppose. At least to me. I'm sure someone can >pick holes in it? Well, I suppose if I were feeling magnanimous towards Microsoft - not a tendency I fall into very often - I would argue that With/End With came along later. MM |