WIN32: customized dialog box buttons
Alan Tu asked:
>Just to confirm, it is not possible to make buttons in dialog boxes that=
>say what one wants them to say using <message_box>? Can I do this in
>Win32lib?
>Alan
What do you think of this solution?
-- init.ew
-- to initialize and put globals in
include msgbox.e
include win32lib.ew
global constant
Main =3D create(Window, title, 0, 0, 0, 800, 570, 0),
Outline =3D create(Group, "", Main, 10, 0, 775, 500, 0),
PopupFile =3D definePopup(Main, "&File"),
MenuExit =3D definePopupItem(PopupFile, "&Exit"),
PopupHelp =3D definePopup(Main, "&Help"),
MenuHelp =3D definePopupItem(PopupHelp, "&Introduction"),
MenuSep1 =3D definePopupItem(PopupHelp, "-"),
MenuAbout =3D definePopupItem(PopupHelp, "&About")
global procedure onMenuExit()
unloadWindow(Main)
end procedure
onMenu[MenuExit] =3D routine_id("onMenuExit")
=
global procedure onMenuAbout()
integer junk
junk =3D message_box(about, "About " & title, MB_TASKMODAL)
end procedure
onMenu[MenuAbout] =3D routine_id("onMenuAbout")
global procedure onLoad_Main()
setWindowBackColor(Main, getSysColor(COLOR_BTNFACE))
end procedure
onLoad[Main] =3D routine_id("onLoad_Main")
-- end of init.ew
-- btn_dlg.exw
-- opening a dialog box with a 'customizable' button
-- if the button reads 'Close', the dialog window is closed!
global constant
title =3D "Dialog with button",
about =3D "A dialog box with a button\n" &
"(c) kwisoft 1998"
include init.ew
constant
dlgbtn =3D create(Window, "Dialog", 0, 100, 0, 200, 100, WS_DLGFRAME)=
,
lblText =3D create(LText, "Give caption:", dlgbtn, 0, 0, 100, 20, 0),=
edtText =3D create(EditText, "", dlgbtn, 100, 0, 80, 20, 0),
btnTest =3D create(PushButton, "", dlgbtn, 50, 30, 100, 25, 0),
dlgMenu =3D definePopup(Main, "&Dialog"),
MenuOpen =3D definePopupItem(dlgMenu, "&Open")
global procedure onMenu_MenuOpen()
loadWindow(dlgbtn)
setWindowBackColor(dlgbtn, getSysColor(COLOR_BTNFACE))
end procedure
onMenu[MenuOpen] =3D routine_id("onMenu_MenuOpen")
global procedure onClick_btnTest(integer x, integer y)
setText(btnTest, getText(edtText))
if compare(getText(btnTest), "Close") =3D 0 then
setVisible(dlgbtn, 0)
end if
end procedure
onClick[btnTest] =3D routine_id("onClick_btnTest")
WinMain(Main)
|
Not Categorized, Please Help
|
|