Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parameters flag in the function do not work
#1
Hi,

I defined a function mes2 but the flag 2 doesn't work

mes2 "hello" 3 2

[Image: 1673138759]


Function mes2
Code:
Copy      Help
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
#2
dont use 3 as a defined flag
 Usually flag values are divisible by two (1, 2, 4, 8, 16, ect)
 
Code:
Copy      Help
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
#3
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

Code:
Copy      Help
mes2 "hello" 3 1 2

I need the message box to appear in the center of the mouse cursor, is this possible?


Function mes2
Code:
Copy      Help
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
#4
I think you're asking for the mouse to be center of the dialog if so, this should do it
 
Code:
Copy      Help
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
#5
Your understanding is correct,  Thank you so much


Forum Jump:


Users browsing this thread: 1 Guest(s)