| 
		
	
	
	
		
	Posts: 576Threads: 97
 Joined: Aug 2007
 
	
	
		Hey this mite not be possible but really curious, i want to make something so people can decide between all the windows open which ones to send a certian message to.... 
for example if someone has to go for a few mins he can check the windows he wants to send the message "brb" to or "b back soon"
 
Only problem ive had is i want to make Checkboxes corresponding to the windows open,
 
like if there are 5 windows open, make 5 check boxes on the dialog and add the IM Name next to it.
 
This gets all the Yahoo IMs that are open and removes the "- Instant Message" Part.....
 ARRAY(int) a; int i; str sc snwin("" "" "YahooMessenger" 0 0 0 a)
 for(i 0 a.len)
 ,sn.getwintext(a[i])
 ,if(sn != "Yahoo! Messenger")
 ,,sn.replacerx("Instant Message")
 ,,sn.replacerx("-")
 ,,out "%s" sn
Thanks in advance!
	 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		If number of controls is unknown, you can create them at run time with CreateControl or CreateWindowEx, and destroy with DestroyWindow or clo. 
Or you can use a tree view control with check boxes.
 
Example dialog with treeview with checkboxes.
 
Function Dialog54
 \Dialog_Editorfunction# hDlg message wParam lParam
 if(hDlg) goto messages
 
 if(!ShowDialog("Dialog54" &Dialog54)) ret
 
 ;BEGIN DIALOG
 ;0 "" 0x90C80A44 0x100 0 0 223 203 "Dialog"
 ;3 SysTreeView32 0x54030000 0x0 2 2 164 178 ""
 ;4 Button 0x54032000 0x0 172 6 48 14 "Refresh"
 ;5 Button 0x54032000 0x0 172 30 48 22 "Flash Selected"
 ;6 Button 0x54032000 0x0 172 58 48 22 "Activate Selected"
 ;1 Button 0x54030001 0x4 118 186 48 14 "OK"
 ;2 Button 0x54030000 0x4 170 186 48 14 "Cancel"
 ;END DIALOG
 ;DIALOG EDITOR: "" 0x2020105 "" "" ""
 
 ret
 ;messages
 sel message
 ,case WM_INITDIALOG
 ,TvAddWindows id(3 hDlg)
 ,case WM_DESTROY
 ,case WM_COMMAND goto messages2
 ,case WM_NOTIFY goto messages3
 ret
 ;messages2
 sel wParam
 ,case 4 ;;Refresh
 ,TvAddWindows id(3 hDlg)
 ,
 ,case [5,6] ;;flash or activate selected
 ,ARRAY(int) ah; int i
 ,TvGetItems id(3 hDlg) 0 ah 1
 ,for i 0 ah.len
 ,,sel wParam
 ,,,case 5 FlashWindow ah[i] 1
 ,,,case 6 act ah[i]; err
 
 ,case IDOK
 ,case IDCANCEL
 ret 1
 ;messages3
 NMHDR* nh=+lParam
 sel nh.idFrom
 ,case 3 ;;treeview
 ,sel nh.code
 ,,case TVN_SELCHANGED ;;treeview item selected
 ,,NMTREEVIEW* ntv=+nh
 ,,int h=ntv.itemNew.lParam ;;window handle (set by TvAdd)
 ,,out "item selected: %s" _s.getwintext(h)
Function TvAddWindows
 ;/function htv
 
 SetWinStyle htv TVS_CHECKBOXES 1
 SendMessage htv TVM_DELETEITEM 0 0 ;;delete all
 
 ARRAY(int) a; int i
 win "" "" "" 0 0 0 a
 for i 0 a.len
 ,int h=a[i]
 ,if(GetWinStyle(h 1)&WS_EX_TOOLWINDOW) continue
 ,str s.getwintext(h); if(!s.len) continue
 ,;out s
 ,TvAdd htv 0 s h
 ,
Function TvGetItems
 ;/function htv ARRAY(int)&ahi [ARRAY(int)&apar] [flags] ;;flags: 1 only checked
 
 ;Gets handles and/or lParams of tree view items, only those at root.
 
 if(&ahi) ahi.redim
 if(&apar) apar.redim
 int hi=SendMessage(htv TVM_GETNEXTITEM TVGN_ROOT 0)
 rep
 ,if(!hi) break
 ,if(flags&1 and !TvIsChecked(htv hi)) goto next
 ,if(&ahi) ahi[]=hi
 ,if(&apar) apar[]=TvGetParam(htv hi)
 ,;next
 ,hi=SendMessage(htv TVM_GETNEXTITEM TVGN_NEXT hi)
Function TvIsChecked
 ;/function htv hitem
 
 ret SendMessage(htv TVM_GETITEMSTATE hitem TVIS_STATEIMAGEMASK)>>12=2
 
	
	
	
		
	Posts: 576Threads: 97
 Joined: Aug 2007
 
	
	
		Hey i run it and get this error 
Error in Dialog54:  expected 0 arguments, not 4.
 
It highlights this in the dialog
 ,TvGetItems id(3 hDlg) 0 ah 1
 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		You probably forgot to paste code into TvGetItems.
	 
	
	
	
		
	Posts: 576Threads: 97
 Joined: Aug 2007
 
	
	
		WOW i feel stupid lol
 Thanks works perfect!
 
	
	
	
		
	Posts: 26Threads: 6
 Joined: Mar 2008
 
	
	
		awesome dialog i like it but when i tryed it i cant seem to get the dialog box to close ?
	 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		The dialog does not work in QM 2.1.8 and earlier versions. Install new QM version.
	 |