Re: RE: ES_NUMERIC

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

Hello Rubens,

ES_NUMBER (also known as ES_NUMERIC is win32lib) does not appear to be working
in Windows 2000.

An alternative (with more flexibility) is to do something like this..

  constant vFldSize = {  -1, fld1, fld3, fld5}
  constant vMaxSize = {9999,    4,    5,   19}

  function CharFilter(integer pChar, sequence pFilter)
  -- Echo the character if its in the list else return -1
    if find(pChar, pFilter) then
        return pChar
    else
        return -1
    end if
  end function

  procedure ForceDigit(integer self, integer event, sequence parms)    
    returnValue(CharFilter(parms[1], "0123456789" & VK_BACKSPACE) )
  end procedure

  procedure ForceHexDigit(integer self, integer event, sequence parms)    
    returnValue(CharFilter(parms[1], "0123456789ABCDEF" & VK_BACKSPACE) )
  end procedure

  procedure CheckSize(integer self, integer event, sequence parms)    
    if parms[1] != VK_BACKSPACE then
        if length(getText(self)) >= vMaxSize[find(self, vFldSize)+1] then
            returnValue(-1)
        end if
    end if    
  end procedure

  -- Trap all the fields that can only have digits.
  setHandler({fld2, fld3}, w32HKeyPress, routine_id("ForceDigit"))

  -- Trap all the fields that can only have hexadecimal digits.
  setHandler({fld1}, w32HKeyPress, routine_id("ForceHexDigit"))

  -- Trap all the fields that have size restrictions.
  setHandler({fld1, fld3, fld5}, w32HKeyPress, routine_id("CheckSize"))

---------
Derek.

23/10/2002 9:46:55 AM, Brian Broker <bkb at cnw.com> wrote:

>
>Hi Rubens,
>
>Try ES_NUMBER.
>
>Find other edit styles at:
>http://msdn.microsoft.com/library/en-
us/shellcc/platform/commctls/editcontrols/editcontrolreference/editcontrolstyles.asp
>
>
>-- Brian
>
>Rubens wrote:
>> Hi people;
>> 
>> 	The flag ES_NUMERIC is working or not in win2000 ???
>> 
>> 	Where can I find a list of flags for each control in the docs ?
>> 	I didn't find, for example, this flag in the win32lib doc.
>> 
>> 
>> Thanks
>> 
>> Rubens
>> 
>> 
>
>
>
---------
Cheers,
Derek Parnell 
ICQ# 7647806

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

Search



Quick Links

User menu

Not signed in.

Misc Menu