Setting Input Mask for dynamically created datafield

forum.td.development (2005-2010)
BSB

Setting Input Mask for dynamically created datafield

Post by BSB » 23 Jul 2009, 09:14

 Posted by:  BSB 

Hi,
How can I set input mask and data type for a dynamically created datafield
using SalDynamicCreateDataField( SalExtension.apl function )?

Thanks in Advance,
Seshu.

Thomas Lauzi

Setting Input Mask for dynamically created datafield

Post by Thomas Lauzi » 23 Jul 2009, 11:26

 Posted by:  Thomas Lauzi 

Hi Seshu,

with "SalDynamicCreateDataField" you create a standard windows datafield,
which is totally stupid control and doesn´t know anything about datatypes or
format pictures.
To handle a input mask would be hard, but the datatype could be attached as
a property value and checked on leaving the field.

hWndTest = SalDynamicCreateDataField( hWndForm, 10,5,100,20 )
Call VisWinSetProp(hWndTest, 'Datatype', DT_NUMBER)

On WM_COMMAND
Call SalDynamicGetMsg( hWndControlNotify, nMsg )
Select Case SalDynamicGetType( hWndControlNotify )
!
Case TYPE_DataField
Select Case nMsg
Case EN_CHANGE
Break
Case EN_SETFOCUS
Break
Case EN_KILLFOCUS
Select Case VisWinGetProp(hWndControlNotify , 'Datatype')
Case DT_Number
If NOT SalIsValidNumber(hWndControlNotify)
Call SalMessageBox('Not a valid
number!','Validate',MB_Ok)
Call SalSetFocus(hWndControlNotify)
<--set focus back to the field, but be carefull, if focus changing from
windows hasn´t finished, you need to post a message where to do, otherwise
this could lead to a crash!!!
Break
Case DT_DateTime
....
Break
Break
Break
!

BSB

Setting Input Mask for dynamically created datafield

Post by BSB » 23 Jul 2009, 13:45

 Posted by:  BSB 

Thanks a lot Thomas.

Seshu.

Return to “td.development”

Who is online

Users browsing this forum: [Ccbot] and 0 guests