| 
		
	
	
	
		
	Posts: 153Threads: 33
 Joined: Aug 2009
 
	
	
		Hi Gintaras ! 
What im trying to do :
 
i want to show the on desktop saved notepads in a dropdown combobox , no problem so far,now i want to show the fileinfo if i select one. 
i know how to use .getfile etc. and i know how  to bring the data of the selected file to an other combo or listbox but i want it in the same box if possible!?
 
here my code so far ;
 
Function Dialog342 \Dialog_Editorfunction# hDlg message wParam lParam
 if(hDlg) goto messages
 
 ;BEGIN DIALOG
 ;0 "" 0x90CA0AC8 0x0 0 0 145 107 "Dialog"
 ;3 ComboBox 0x54230243 0x0 28 16 94 213 ""
 ;END DIALOG
 ;DIALOG EDITOR: "" 0x2030202 "*" "" ""
 
 str controls = "3"
 str cb3
 cb3= "&Select List"
 
 if(!ShowDialog("Dialog342" &Dialog342 &controls)) ret
 ret
 ;messages
 sel message
 ,case WM_INITDIALOG
 
 ,ARRAY(str) a; int i
 ,GetFilesInFolder a "$desktop$\" "*.txt"
 ,for i 0 a.len
 ,,_s=a[i]
 ,,_s.getfilename
 ,,CB_Add id(3 hDlg) _s
 
 ,case WM_DESTROY
 ,case WM_COMMAND goto messages2
 ret
 ;messages2
 sel wParam
 ,case IDOK
 ,case IDCANCEL
 ret 1
best regards.
	 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		Change combo box item text when you select it?Or add more items with file info?
 Why not to display the info in a static or edit control?
 
	
	
	
		
	Posts: 153Threads: 33
 Joined: Aug 2009
 
	
	
		yes ,change combo box item text when i select it. lets say i got some settings saved in a notepad and when i select one it displays it in the same box.I want to use it instead of a drag n drop combobox.
	 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		Function Dialog342 \Dialog_Editorfunction# hDlg message wParam lParam
 if(hDlg) goto messages
 
 ;BEGIN DIALOG
 ;0 "" 0x90CA0AC8 0x0 0 0 145 107 "Dialog"
 ;3 ComboBox 0x54230243 0x0 28 16 94 213 ""
 ;END DIALOG
 ;DIALOG EDITOR: "" 0x2030202 "*" "" ""
 
 str controls = "3"
 str cb3
 cb3= "&Select List"
 
 if(!ShowDialog("Dialog342" &Dialog342 &controls)) ret
 ret
 ;messages
 sel message
 ,case WM_INITDIALOG
 
 ,ARRAY(str) a; int i
 ,GetFilesInFolder a "$desktop$\" "*.txt"
 ,for i 0 a.len
 ,,_s=a[i]
 ,,_s.getfilename
 ,,CB_Add id(3 hDlg) _s
 
 ,case WM_DESTROY
 ,case WM_COMMAND goto messages2
 ret
 ;messages2
 sel wParam
 ,case CBN_DROPDOWN<<16|3
 ,SendMessage lParam CB_RESETCONTENT 0 0
 ,;and now add all items again, like you did it under WM_INITDIALOG. You even don't have to do it under WM_INITDIALOG.
 ,
 ,case IDOK
 ,case IDCANCEL
 ret 1
 
	
	
	
		
	Posts: 153Threads: 33
 Joined: Aug 2009
 
	
	
		I figured out how to do what i was looking for  
Im not sure if it is the right way !? maybe u can clean it up a bit
 
Function Dialog2 \Dialog_Editorfunction# hDlg message wParam lParam
 if(hDlg) goto messages
 
 ;BEGIN DIALOG
 ;0 "" 0x90CA0AC8 0x0 0 0 183 82 "Dialog"
 ;3 ComboBox 0x54230243 0x0 10 26 94 213 ""
 ;6 Button 0x54032000 0x0 110 26 48 14 "Refresh"
 ;7 Button 0x54032007 0x0 4 4 170 62 ""
 ;END DIALOG
 ;DIALOG EDITOR: "" 0x2030202 "*" "" ""
 
 str controls = "3"
 str cb3
 cb3= "&Select List"
 
 if(!ShowDialog("Dialog2" &Dialog2 &controls)) ret
 ret
 ;messages
 sel message
 ,case WM_INITDIALOG
 
 ,ARRAY(str) a; int i
 ,GetFilesInFolder a "$desktop$\" "*.txt"
 ,for i 0 a.len
 ,,_s=a[i]
 ,,_s.getfilename
 ,,CB_Add id(3 hDlg) _s
 
 ,case WM_DESTROY
 ,case WM_COMMAND goto messages2
 ret
 ;messages2
 sel wParam
 ,case CBN_CLOSEUP<<16|3
 
 ,str s s2
 ,int hcb=id(3 hDlg)
 ,_i =(CB_SelectedItem(id(3 hDlg) s)>= 0)
 ,s.from("$desktop$\" s ".txt")
 ,s2.getfile(s)
 ,err ret
 ,SendMessage hcb CB_RESETCONTENT 0 0
 ,foreach s s2
 ,,CB_Add hcb s
 ,CB_SelectItem hcb 0
 
 ,case 6
 ,mac "Refresh"
 ,case IDOK
 ,case IDCANCEL
 ret 1
 Function to refresh the box
 
Function Refresh int hDlg=win("Dialog" "#32770")int hcb=id(3 hDlg)
 
 SendMessage hcb CB_RESETCONTENT 0 0
 ARRAY(str) a; int i
 GetFilesInFolder a "$desktop$\" "*.txt"
 for i 0 a.len
 ,_s=a[i]
 ,_s.getfilename
 ,CB_Add hcb "Select List"
 ,CB_Add hcb _s
 ,CB_SelectItem hcb 0
As i already said im not sure if that is the right way and im still learning so maybe this code gives u a smile      but it works..
 
best regards
	 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		Function Dialog342 \Dialog_Editorfunction# hDlg message wParam lParam
 if(hDlg) goto messages
 
 ;BEGIN DIALOG
 ;0 "" 0x90CA0AC8 0x0 0 0 145 107 "Dialog"
 ;3 ComboBox 0x54230243 0x0 28 16 94 213 ""
 ;END DIALOG
 ;DIALOG EDITOR: "" 0x2030202 "*" "" ""
 
 str controls = "3"
 str cb3
 cb3= "&Select List"
 
 if(!ShowDialog("Dialog342" &Dialog342 &controls)) ret
 ret
 ;messages
 sel message
 ,case WM_INITDIALOG
 ,case WM_DESTROY
 ,case WM_COMMAND goto messages2
 ret
 ;messages2
 sel wParam
 ,case CBN_DROPDOWN<<16|3
 ,SendMessage lParam CB_RESETCONTENT 0 0
 ,ARRAY(str) a; int i
 ,GetFilesInFolder a "$desktop$\" "*.txt"
 ,for i 0 a.len
 ,,CB_Add lParam a[i].getfilename
 ,
 ,case CBN_SELENDOK<<16|3
 ,_i=CB_SelectedItem(lParam _s)
 ,out _i
 ,out _s
 ,
 ,case CBN_CLOSEUP<<16|3
 ,SendMessage lParam CB_RESETCONTENT 0 0
 ,SendMessage lParam CB_SETCURSEL CB_Add(lParam "Select List") 0 ;;don't use CB_SelectItem because it notifies dialog, ie sends CBN_SELENDOK
 ,
 ,case IDOK
 ,case IDCANCEL
 ret 1
 
	
	
	
		
	Posts: 153Threads: 33
 Joined: Aug 2009
 
	
	
		this does not what mine does! but its ok i will use mine...
 thank you
 best regards
 |