1. Turning off Tab trapping

Can someone please tell me how to stop variuos win32lib 
controls(pushbuttons etc..) from trapping the TAB key? The answer may 
require editing win32lib itself.

Thanks.

vulcan at win.co.nz

new topic     » topic index » view message » categorize

2. Re: Turning off Tab trapping

----- Original Message ----- 
From: "Mike" <vulcan at win.co.nz>
To: "EUforum" <EUforum at topica.com>
Subject: Turning off Tab trapping

Hi Mike,

> 
> Can someone please tell me how to stop variuos win32lib 
> controls(pushbuttons etc..) from trapping the TAB key? The answer may 
> require editing win32lib itself.
> 

here is a routine that can do want you want...

-------------------------
-- Remove the default style and extended style flags from
-- specified types of controls.
procedure remStyleFlags(object wintype, object styleflag, object exflag)
-- wintype ==> One or more control types.
-- styleflag ==> One or more style flags to remove.
-- exflag ==> One or more extended flags to remove.

    integer x
    sequence oldstyles

    -- convert atoms to sequences
    if atom(wintype) then
        wintype = {wintype}
    end if
    if atom(styleflag) then
        styleflag = {styleflag}
    end if
    if atom(exflag) then
        exflag = {exflag}
    end if

    -- Change each control type mentioned.
    for i = 1 to length(wintype) do
        -- Get the current flags.
        oldstyles = classDefaults(wintype[i], {})

        -- Remove each style flag specified.
        for j = 1 to length(styleflag) do
            x = find(styleflag[j], oldstyles[1][2])
            if x then
                oldstyles[1][2][x] = 0
            end if
        end for

        -- Remove each extended style flag specified.
        for j = 1 to length(exflag) do
            x = find(exflag[j], oldstyles[2][2])
            if x then
                oldstyles[2][2][x] = 0
            end if
        end for

        -- set the new defaults for the control
        oldstyles = classDefaults(wintype[i], oldstyles)
    end for
    
end procedure
-------------------------

An example of its use...
-- Remove tab stopping from buttons and edit boxes.
remStyleFlags({PushButton, DefPushButton, EditText}, WS_TABSTOP, {})

-- Create flat looking edit boxes
remStyleFlags(EditText, {}, WS_EX_CLIENTEDGE)

If you use these before creating any controls of this type, it should work.

------
Derek Parnell
Melbourne, Australia
"To finish a job quickly, go slower."

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu