Posts: 262
Threads: 63
Joined: Nov 2005
I really like the fact that you can lump cases together
Example:
case [1011,1103]
Can this be done with these examples? I have tried with no success.
NoVisualStyles id([2,3,4] hDlg)
EnableWindow id([10,11,12] win("Try" "#32770")) 0
EnableWindow id([10,11,12] win("Try" "#32770")) 1
Hid id([10,11,12] win("Try" "#32770"))
Hid- id([10,11,12] win("Try" "#32770"))
Posts: 229
Threads: 22
Joined: Sep 2007
yes it can be done.
there is a function but it is in obselete. named TO_Show
Function
Enable
;/
function hwnd $items enable
enable=enable!0
int i v enable2
rep
,if(items[i]='-') i+1; enable2=!enable; else enable2=enable
,v=val(items+i)
,EnableWindow(id(v hwnd) enable2)
,i=findcs(items " -" i)+1; if(i=0) break
,if(items[i-1]='-')
,,for(v v+1 val(items+i)+1) EnableWindow(id(v hwnd) enable2)
,,i=findc(items 32 i)+1; if(i=0) break
example
int hwnd = win("Try" "#32770")
Enable hwnd "10, 11, 12" 0
Posts: 262
Threads: 63
Joined: Nov 2005
I could get the EnableWindow id’s to work but I can not seem to get the NoVisualStyles and Hid to work. Can you give me an example of them?
Posts: 11,924
Threads: 138
Joined: Dec 2002
Function
MultiControlAction
;/
function hDlg $idList *action [_on] ;;action: MCA_Show, MCA_Enable, MCA_Check, MCA_NoTheme
;Performs an action on multiple dialog controls specified as a list of ids.
;hDlg - dialog handle.
;idList - list of control ids. Separate ids using space. Use hyphen to specify range of ids. Use -id to reverse action for some controls.
;action - a function that performs an action. Beside the predefined functions you can create your own functions. See MCA_Show code.
;_on - if 1, turns the property on (eg shows), if 0 - off (eg hides). Ignored with MCA_NoTheme.
;EXAMPLE
;MultiControlAction hDlg "3 5-7 -11" MCA_Enable 0
int i v h on
ARRAY(POINT) a; POINT& p
rep
,if(idList[i]='-') i+1; on=!_on; else on=_on!0
,v=val(idList+i); h=id(v hDlg); if(h) &p=a[]; p.x=h; p.y=on
,i=findcs(idList " -" i)+1; if(i=0) break
,if(idList[i-1]='-')
,,for(v v+1 val(idList+i)+1) h=id(v hDlg); if(h) &p=a[]; p.x=h; p.y=on
,,i=findc(idList 32 i)+1; if(i=0) break
call action &a
Function
MCA_Show
;/
function* [ARRAY(POINT)&a]
if(!&a) ret &MCA_Show
int i
for(i 0 a.len) ShowWindow a[i].x iif(a[i].y SW_SHOW SW_HIDE)
Function
MCA_Enable
;/
function* [ARRAY(POINT)&a]
if(!&a) ret &MCA_Enable
int i
for(i 0 a.len) EnableWindow a[i].x a[i].y
Function
MCA_Check
;/
function* [ARRAY(POINT)&a]
if(!&a) ret &MCA_Check
int i
for(i 0 a.len) SendMessage a[i].x BM_SETCHECK a[i].y 0
Function
MCA_NoTheme
;/
function* [ARRAY(POINT)&a]
if(!&a) ret &MCA_NoTheme
dll- uxtheme #SetWindowTheme hwnd @*pszSubAppName @*pszSubIdList
if(_winver<0x501) ret
int i
for(i 0 a.len) SetWindowTheme a[i].x L"" L""
Posts: 262
Threads: 63
Joined: Nov 2005
Wow this will eliminate dozens of lines of repeating code.