Posts: 1,049
Threads: 249
Joined: Jul 2022
01-05-2023, 12:36 AM
(This post was last modified: 01-05-2023, 12:46 AM by Davider.)
Hi,
I defined a function
mes2 but the
flag 2 doesn't work
mes2 "hello" 3
2
Function
mes2
function str'T S [flag] ;;T text; S countdown; flag style: 2 OC; 3 YNC
MES m
if flag&2
,m.style="OCa"
if flag&3
,m.style="YNCa"
m.default='C'
m.timeout=S
_i=mes(F"{T}" "tip" m)
ret _i
Posts: 1,338
Threads: 61
Joined: Jul 2006
dont use 3 as a defined flag
Usually flag values are divisible by two (1, 2, 4, 8, 16, ect)
function str'T S [flag] ;;T text; S countdown; flag style: 2 OC; 4 YNC
MES m
if flag&2
,m.style="OCa"
if flag&4
,m.style="YNCa"
m.default='C'
m.timeout=S
_i=mes(F"{T}" "tip" m)
ret _i
Posts: 1,049
Threads: 249
Joined: Jul 2022
01-05-2023, 02:38 AM
(This post was last modified: 01-05-2023, 02:41 AM by Davider.)
Thanks for your help, kevin
I added another parameter [Mou],
In the following code, the message box is displayed in the lower-right corner of the mouse cursor
I need the message box to appear in the center of the mouse cursor, is this possible?
Function
mes2
function str'T S [Mou] [flag]
MES m
if flag&2
,m.style="OCa"
if flag&4
,m.style="YNCa"
m.default='C'
if Mou&1
,m.x=xm
,m.y=ym
m.timeout=S
_i=mes(F"{T}" "tip" m)
ret _i
Posts: 1,338
Threads: 61
Joined: Jul 2006
01-05-2023, 04:27 AM
(This post was last modified: 01-05-2023, 02:32 PM by Kevin.)
I think you're asking for the mouse to be center of the dialog if so, this should do it
function str'T S [Mou] [flag]
MES m
if(flag&2)
,m.style="OCa"
if(flag&4)
,m.style="YNCa"
m.default='C'; m.timeout=S
if(Mou&1)
,m.x=xm
,m.y=ym
,mac "sub.centerOnMouse"
_i=mes(F"{T}" "tip" m)
ret _i
#sub centerOnMouse
int w=wait(0 WC win("tip" "#32770"))
int x y cx cy
GetWinXY w x y cx cy
mov x-(cx/2) y-(cy/2) w
Posts: 1,049
Threads: 249
Joined: Jul 2022
Your understanding is correct, Thank you so much