From: Geoff Schaller on 16 Nov 2009 17:18 JD, Actually is it a very good idea. You should have a separate SLE class for things like: Dates Numerics Names Addresses General strings Etc That way you will have consistent behaviour across all your applications across all windows. This is the most appropriate way to code. Geoff "JD" <jdhora(a)ig.com.br> wrote in message news:6b364b80-9e1d-4bc3-8c27-a8b102fd4e35(a)g23g2000yqh.googlegroups.com: > On 13 nov, 21:35, "Stephen Quinn" <stevej...(a)bigpondSPAM.net.au> > wrote: > > > Jairo > > > > > > Is it possible in dispatch to know in witch control the user are when > > > he is imputing the data? > > > > > You might also tell us what your trying to achieve by manipulating controls > > this way. > > > > You'd need some way of telling the control to 'act' in a particular manner > > at runtime which is very difficult to do as all you have is the data entered > > by the user to define any change of behaviour. > > > > If you want the controls to 'act' in a particular manner then program the > > intelligence into individual controls and inherit from them. > > > > CYA > > Steve > > > Depending of the control i need block some characters. example: sle_1 > typed character = "." or ";" ... return 1L; sle_2 typed character = > "a", "b" ... return 1L. > > I think is not a good idea to create an inherited class of > singlelineedit for each control. > > That is it. > > TIA. > > Jairo.
From: Stephen Quinn on 16 Nov 2009 18:15 Jairo > I think is not a good idea to create an inherited class of > singlelineedit for each control. An objective of OO is for each object to do 1 thing only, having controls try to be everything for every situation is a support nightmare just waiting to happen. If you really want to go this way then look in the SDK for the source of the SLE control eg setting the controls to Numeric or Alpha only or RightSLE sources CYA Steve
From: Amilcar A. Camargo on 17 Nov 2009 14:35 Hi Jairo, On Mon, 16 Nov 2009 07:18:54 -0800 (PST), JD <jdhora(a)ig.com.br> wrote: >Depending of the control i need block some characters. example: sle_1 >typed character = "." or ";" ... return 1L; sle_2 typed character = >"a", "b" ... return 1L. > >I think is not a good idea to create an inherited class of >singlelineedit for each control. Yes, it's a good idea. The best way to achieve what you're trying to do is to create an internal export variable in your class where you can setup what characters to block-out, then in your dispatch you check the input character against this variable and block if necessary. More or less: CLASS MySLE INHERIT SingleLineEdit EXPORT cBlockOut AS STRING METHOD Dispatch( oEv ) CLASS MySLE LOCAL oEvent AS Event LOCAL cChar AS STRING oEvent := oEv DO CASE CASE oEvent:Message == WM_CHAR IF Slen( SELF:cBlockOut ) > 0 cChar := CHR( oEvent:wParam ) IF InStr( cChar, SELF:cBlockOut ) SELF:EventReturnValue := 0L RETURN 1L ENDIF ENDIF ENDCASE RETURN SUPER:Dispatch( oEv ) Then, in your window PostInit you can setup what to block: SELF:oDCMySLE:cBlockOut := "lLcC" Maybe you will get some 'beeps' because you are 'killing' the keyboard sequence (WM_KEYDOWN, WM_CHAR, WM_KEYUP). Give it a try Best regards, Amilcar A. Camargo F. Guatemala, C. A.
First
|
Prev
|
Pages: 1 2 Prev: VODC 2009 Next: Lowlevel printing (ESC-codes sending to printer) with Vista ***THIS WORKS*** |