1. Another Win32Lib problem...

Hello,

I was trying to create a Windows program using
Win32Lib and ran into a problem: I wanted to
create a SLE which would show asterisks instead
of the characters typed (like when you type a
password). But then I noticed that, when the
program read the contents of the SLE, all the
letters were converted to uppercase!

The following program is an example of the
problem. There are two boxes: the first is
a normal SLE, and the second masks the characters.
When the "Copy 1 to 2" button is pressed, the
contents of the first SLE are copied to the
second one, and when the "Copy 2 to 1" button
is pressed, the contents of the second SLE are
copied to the first one.

Try typing something in the first box, copying
it into the second one and copying it back into
the first one, or simply typing something into
the second box and copying it into the first
one, and you'll see what I mean.


-- begin slebug.exw --
include win32lib.ew

constant                                      =

    Win =3D create( Window, "SLE Bug Example", 0,
     Default, Default, 300, 100, 0 ),  =


    -- normal SLE
    Sle1 =3D create( EditText, "", Win, 10, 10, 120, 20, 0),

    -- shows asterisks instead of chars
    Sle2 =3D create( EditText, "", Win, 10, 40, 120, 20, '*'),

    Button1 =3D create( PushButton, "Copy 1 to 2", Win,
     140, 10, 120, 20, 0 ),
    Button2 =3D create( PushButton, "Copy 2 to 1", Win,
     140, 40, 120, 20, 0 )


procedure onClick_Button1()
    -- Copies contents of Sle1 into Sle2
    setText(Sle2,getText(Sle1))
end procedure

procedure onClick_Button2()
    -- Copies contents of Sle2 into Sle1
    setText(Sle1,getText(Sle2))
end procedure

onClick[ Button1 ] =3D routine_id("onClick_Button1")
onClick[ Button2 ] =3D routine_id("onClick_Button2")


WinMain( Win )

-- end slebug.exw --


I don't know if it's a problem with my program,
with Win32Lib, with Windows or with my computer;
I really have no idea about what's happening. My
computer is a PII-233 running Win95, and I am
using Euphoria 2.0 (but I tested with 2.1 too)
and Win32Lib 0.15c. Does anyone know what the
problem is, and how to solve it?

Regards,
Davi Figueiredo
davitf at usa.net

____________________________________________________________________
Get free e-mail and a permanent address at http://www.amexmail.com/?A=3D1=

new topic     » topic index » view message » categorize

2. Re: Another Win32Lib problem...

Davi Figueiredo wrote:

>    -- shows asterisks instead of chars
>    Sle2 = create( EditText, "", Win, 10, 40, 120, 20, '*'),

By passing a '*', you are passing the number 42 (the ASCII value of '*') as
your edit and window style flags - Win32 apparently read that as a
combination of EX_UPPERCASE and some other flags that I'm too lazy to work
out.

Try instead:

>    Sle2 = create( EditText, "", Win, 10, 40, 120, 20, ES_PASSWORD ),

I don't currently have that flag defined; I'll try to get it added to then
next update. It is:

    ES_PASSWORD = #20

Here are some other flags, some of which *are* defined in Win32Lib.ew:

    ES_LEFT = #0,
    ES_CENTER = #1,
    ES_RIGHT = #2,
    ES_MULTILINE = #4,
    ES_UPPERCASE = #8,
    ES_LOWERCASE = #10,
    ES_PASSWORD = #20,
    ES_AUTOVSCROLL = #40,
    ES_AUTOHSCROLL = #80,
    ES_NOHIDESEL = #100,
    ES_OEMCONVERT = #400,
    ES_READONLY = #800,
    ES_WANTRETURN = #1000,

Hope this helps.

-- David Cuny

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

Search



Quick Links

User menu

Not signed in.

Misc Menu