RE: How To set ltext to numeric

new topic     » topic index » view thread      » older message » newer message

Tony,

I'm assuming that you want an edit control where the user can input a 
decimal point along with some numbers.  The problem here is that 
ES_NUMERIC style for an edit control only allows numbers, not decimal 
points, commas, signs.

To do this you could create a regular edit control and add this handler:

procedure ctl_onKeyPress(integer self, integer event, sequence parms)
    atom keyCode, shift, text_len, num_dec, num_max_len, dec, sign
    sequence valid_key
    keyCode = parms[1]
    shift = parms[2]
    if cur_ctl = num_edit then
        valid_key = "0123456789."
        if not find(keyCode, valid_key) and keyCode != VK_BACK then
            returnValue(True)
        end if
    end if
end procedure

This would only allow the entry of 0-9 and the decimal point.  You could 
also add a ',', negative sign '-' or any other formatting options you 
wanted.

HTH,

Jonas
Tony Steward wrote:
> Hi All,
> I use win32lib57.9 and wish to know how to set ltext to accept ony 
> numeric 
> input. The input would be in monetary form so a typical entry may be 
> 30.36.
> Using Judiths IDE I see it can be set to numeric but it wont allow the 
> decimal point
> 
> Thanks in advance
> 
> Tony
> 
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu