Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

editchanging event

161 views
Skip to first unread message

Arnoud Oortwijk

unread,
Apr 27, 2004, 6:21:58 AM4/27/04
to
Does anybody know if the dwneditchanging event on a DW control has a return
value that ommits the last key stroke?

My problem is as follows.
I have a decimal column on a DW. I to prevent the user from entering invalid
characters like abc etc.
I know I can do this using the editchange event. But when the the user
enters 1.a I want to ommit the 'a' only 1. should remain in the edit field.

I want to implement this on my ancestor object. As such I'd prefer not to
use edit masks.

Any help would be greatly appreciated.

Kindest regards,

Arnoud


Philip Salgannik

unread,
Apr 27, 2004, 7:55:49 PM4/27/04
to
Editchanging won't help you.
You need pbm_dwnkey combined with Peekmessage API:
function boolean PeekMessageA (ref blob lpMsg, long hWnd, uint
uMsgFilterMin, uint uMsgFilterMax, uint wRemoveMsg) library "user32.dll"

In pbm_dwnkey you'll write smth like:

blob{28} lblb_msg
integer lpdot
string lscurrt
boolean lb_remove

CHOOSE CASE key
CASE Key1!, Key2!, Key3!, Key4!, Key5!, Key6!, Key7!, Key8!, Key9!,
Key0!, KeyBack!, &
KeyDelete!, keyleftarrow!, keyrightarrow!, keynumpad0!,
keynumpad1!, keynumpad2!, keynumpad3!, &

keynumpad4!,keynumpad5!,keynumpad6!,keynumpad7!,keynumpad8!,keynumpad9!

CASE keyperiod!

lscurrt = GetText()
lpdot = Pos(lscurrt, ".")
IF lpdot > 1 THEN
lpdot = Pos(lscurrt, ".", lpdot)
lb_remove = lpdot > 0
END IF

CASE ELSE
lb_remove = TRUE

END CHOOSE

IF lb_remove THEN PeekMessageA(lblb_msg,0,256,264,1)

RETURN 0

Obviously above has a very crude method of parcing for a decimal separator,
you'll have to come up with something production ready.

pbm_thisusuallydoesnothelp:-))
Philip Salgannik

"Arnoud Oortwijk" <arnoud oortwijk> wrote in message
news:408e3446@forums-1-dub...

0 new messages