1. win32 tutor part 3

Win32 tutorial part 3

As promised we are going to play around with Windows controls. But as I
think I have been a little too theoretic, I will put in more practice fro=
m
now on. I'm sorry for the people that want to dive deeper into the 'guts'=

of Windows programming, but for the moment my aim will be to develop a
quite simple application, building up slowly step by step.
The application I have in mind will be an 'address manager', to build a
sort of database of your friends names (someone once said to me: "If you
are seriously about programming a database of your friends, in the end yo=
u
will have a database, but no friends to put into it").
The program should be able to add, change, delete data and sort them in
different ways. But, as said before, the main aim of developing it will b=
e
'educational'.

So, the first item I concentrate upon will be: message_box(). 'But that's=

not in Cuny's library!', I hear you say. No, that's right, but it comes
standard with Euphoria!
Look at the msgbox.e file in the include directory. This could give you
some insight into using the API functions, and you don't have to write
event handlers or build controls for it. This time all this is already do=
ne
for you! Just type in this little demo program:

-- mbdemo01.exw
-- a message_box demo program
include msgbox.e

integer result

result =3D message_box("Got the message?", "", 0)
-- end of mbdemo01.exw

That's all! If you run it, the message box will appear with only an 'OK'
button. But of course there's more to do with it. Look at the function. I=
t
has three parameters: a sequence holding the message, a sequence for the
caption(title) of the box and an object for the 'box style'. And it retur=
ns
an integer that can be used by the rest of your application.
The box style is an object variable; it can hold an atom, for instance '0=
'
for the default behavior, but it can also hold a sequence of atoms, that
get or-ed together and represent different styles.
The 'result' variable can have a value from 0 to 7, the meaning of the
values is listed in the msgbox.e file. As homework to experiment with, I
give you mbdemo02.exw:

-- mbdemo02.exw
include msgbox.e

integer result
sequence text

result =3D message_box("Got the message?", "MB demo 02",
                     {MB_YESNO, MB_ICONQUESTION})

if result =3D IDYES then
    text =3D "You got the message!"
elsif result =3D IDNO then
    text =3D "Haven't you got the message?"
else
    -- this should never happen
    text =3D "What have you been doing?"
end if

result =3D message_box(text, "Message Confirmation", MB_ICONINFORMATION)
-- end of mbdemo02.exw

This ends this post for today. If you have any questions, please email me=
,
Ad_Rienks at compuserve.com

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu