Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using custom image in mes?
#1
Hi i was wondering how to use a custom icon/image in "mes" command.
I saw it was posible to get a QM icon using "q" as style, but i like to use my own.
ShowSplash is called from init2.
Im trying to mimic the behaviour of this using custom dialog, but im too new at useing that.
Plus it does not automaticaly resize width or have timer, or same font...
Any help is welcome.
This is what i use atm:
Code:
Copy      Help
;*******************************************
;,ShowSplash v1.0
;*******************************************
;This is to show our Splash Screen
;*******************************************

opt waitmsg 1
MES m
m.style = "i"
m.timeout = 120
sText = "  [9]All initialisations are done, and system is up and running."
sText + _s.getmacro("Readme.License")
sText + _s.getmacro("Readme.Introduction")
;mes(sText "Welcome to the JobSystem for DragonRaja" m)

;\Dialog_Editor
str dd=
;BEGIN DIALOG
;0 "" 0x90C00A44 0x80 0 0 300 140 "Welcome to the JobSystem for DragonRaja"
;1 Button 0x54030001 0x4 126 124 48 14 "OK"
;2 Button 0x44030000 0x4 250 124 48 14 "Cancel"
;3 Static 0x5400100E 0x20000 12 12 37 70 ""
;4 Static 0x54000000 0x0 48 0 300 140 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010806 "" ""


str controls = "3 4"
str sb3my.expandpath("$my qm$\DragonRaja\images\Tri-Moon.gif")
str st4 = "  [9]All initialisations are done, and system is up and running."
st4 + _s.getmacro("Readme.License")
st4 + _s.getmacro("Readme.Introduction")
if(!ShowDialog(dd 0 &controls 0 2)) ret

opt waitmsg -1
[Image: SplashScreen.gif]

As you can see there is also a problem with transparancy of that image...
(How to use transparent images in dialogs?)
Well thats all for now, 3M
#2
mes uses Windows API function MessageBoxIndirect. This function allows you to use custom icons, but only from resources that are compiled into the exe or a loaded dll.

In dialogs, transparent are only icons.
#3
Hmm ok i understand, although i tried using a transparent icon also...but ok...

So how i implement the count-down timer for use in custom dialogs?
Well thats all for now, 3M
#4
Function DlgTimer
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("DlgTimer" &DlgTimer)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Static 0x54000000 0x0 16 116 48 13 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010807 "" ""


ret
;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
;int param=DT_GetParam(hDlg)
int-- t
sel message
,case WM_INITDIALOG
,t=5 ;;5 seconds
,_s=t; _s.setwintext(id(3 hDlg))
,SetTimer hDlg 1 1000 0
,ret 1
,
,case WM_TIMER
,t-1
,if(t<1) KillTimer(hDlg 1); clo hDlg
,else _s=t; _s.setwintext(id(3 hDlg))
,
,case WM_SETCURSOR sel(lParam>>16) case [WM_LBUTTONDOWN,WM_NCLBUTTONDOWN] KillTimer hDlg 1

,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
#5
ty very much but....
Do i see it correct that it changes he text in the static control #3?
To have it change window title, should i use id(0 hDlg) where you used id(3 hDlg)?
Because i like to change the title like the mes command did :lol:
(You did that in a very nice way)
Well thats all for now, 3M
#6
hDlg is dialog window handle.
s.setwintext(hDlg)
#7
Thank you, i implemented this functionality in my function now and all works great :lol:
Code:
Copy      Help
;*******************************************
;,ShowSplash v1.1
;*******************************************
;This is to show our Splash Screen
;*******************************************
\Dialog_Editor

function# [hDlg] [message] [wParam] [lParam]
if(hDlg) goto messages

str-- sTitle = "Welcome to the JobSystem for DragonRaja."
str dd=
;BEGIN DIALOG
;0 "" 0x90C00A44 0x80 0 0 300 140 ""
;1 Button 0x54030001 0x4 126 124 48 14 "OK"
;2 Button 0x44030000 0x4 250 124 48 14 "Cancel"
;3 Static 0x5400100E 0x20000 12 12 37 70 ""
;4 Static 0x54000000 0x0 48 0 300 140 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010806 "" ""


str controls = "0 3 4"
str f
str sb3my.expandpath("$my qm$\DragonRaja\images\Tri-Moon.gif")
str st4 = "  [9]All initialisations are done, and system is up and running."
st4 + _s.getmacro("Readme.License")
st4 + _s.getmacro("Readme.Introduction")

opt waitmsg 1
if(!ShowDialog(dd &ShowSplash &controls 0 2)) ret
opt waitmsg -1
ret

;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
;int param=DT_GetParam(hDlg)
int-- t
sel message
,case WM_INITDIALOG
,,t=120 ;;120 seconds
,,f.format("%s - %im%is", sTitle, t/60, t%60)
,,f.setwintext(hDlg)
,,SetTimer hDlg 1 1000 0
,,ret 1
,case WM_TIMER
,,t-1
,,if(t<1)
,,,KillTimer(hDlg 1)
,,,clo hDlg
,,else
,,,f.format("%s - %im%is", sTitle, t/60, t%60)
,,,f.setwintext(hDlg)
,case WM_DESTROY
,,KillTimer hDlg 1
,,DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
Well thats all for now, 3M


Forum Jump:


Users browsing this thread: 1 Guest(s)