Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Updating Combo Box
#1
function: ini_Dialog
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 238 118 ".ini Save on Desktop"
;2 Button 0x54030000 0x4 130 45 96 15 "Close"
;3 ComboBox 0x54230243 0x0 10 5 96 213 ""
;4 Edit 0x54030080 0x200 10 25 96 14 ""
;5 Edit 0x54030080 0x200 130 25 96 14 ""
;6 Button 0x54032000 0x0 10 45 96 15 "Save Changes"
;7 Edit 0x5C030080 0x200 130 5 96 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "" "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 6
,str Selected1.getwintext(id(3 win(".ini Save on Desktop" "#32770")))
,str s4.getwintext(id(4 win(".ini Save on Desktop" "#32770")))
,if Selected1="Today"
,,str t.time("MM-dd-yyyy")
,,str a1.format("$desktop$\%s %s.ini" t s4)
,,goto skip
,else a1.format("$desktop$\%s %s.ini" Selected1 s4)
,;skip
,str e4.getwintext(id(4 win(".ini Save on Desktop" "#32770")))
,str e5.getwintext(id(5 win(".ini Save on Desktop" "#32770")))
,str e7.getwintext(id(7 win(".ini Save on Desktop" "#32770")))
,if(dir(a1))
,,if(mes("This File Already Exists.[]Would you like to save over the data?" ".ini Save on Desktop" "YN?") != 'Y') ret
,str S1="Key"
,rset e4 "e4" S1 a1
,rset e5 "e5" S1 a1
,rset e7 "e7" S1 a1
,case CBN_SELENDOK<<16|3
,_i=CB_SelectedItem(lParam)
,str Selected.getwintext(id(3 win(".ini Save on Desktop" "#32770")))
,if Selected="Today"
,,goto Today
,str a.format("$desktop$\%s.ini" Selected)
,str S ed4 ed5 ed7
,S="Key"
,rget ed4 "e4" S a
,rget ed5 "e5" S a
,rget ed7 "e7" S a
,ed4.setwintext(id(4 win(".ini Save on Desktop" "#32770")))
,ed5.setwintext(id(5 win(".ini Save on Desktop" "#32770")))
,ed7.setwintext(id(7 win(".ini Save on Desktop" "#32770")))
,goto SkipToday
,;Today
,ed7.time("MM-dd-yyy")
,ed4.setwintext(id(4 win(".ini Save on Desktop" "#32770")))
,ed5.setwintext(id(5 win(".ini Save on Desktop" "#32770")))
,ed7.setwintext(id(7 win(".ini Save on Desktop" "#32770")))
,;SkipToday
,case IDOK
,case IDCANCEL
ret 1

Then Macro: ini_Call
Code:
Copy      Help
str controls = "3 4 5 7"
str cb3 e4 e5 e7
cb3="&Today"
e7.time("MM-dd-yyyy")

Dir d
foreach(d "$desktop$\*" FE_Dir)
,cb3.addline(d.FileName)
,cb3.getfilename(cb3)

if(!ShowDialog("ini_Dialog" &ini_Dialog &controls)) ret

The question:
How would I go about getting the drop down box to refresh when it is Dropped down?
Thanks in advance for any help,
Jimmy Vig
#2
DropDownDialog


Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str cb3
if(!ShowDialog("DropDownDialog" &DropDownDialog &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 118 "Dialog"
;1 Button 0x54030001 0x4 4 54 48 14 "OK"
;2 Button 0x54030000 0x4 54 54 48 14 "Cancel"
;3 ComboBox 0x54230243 0x0 0 14 96 213 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "" "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case CBN_DROPDOWN<<16|3
,_i=CB_SelectedItem(lParam)
,RefreshCombo(id(3 hDlg))
,case IDOK
,case IDCANCEL
ret 1


RefreshCombo


Code:
Copy      Help
\
function lis
str tmp
SendMessage(lis CB_RESETCONTENT 0 0)

Dir d
foreach(d "$desktop$\*" FE_Dir)
,tmp.getfilename(d.FileName)
,SendMessage(lis CB_INSERTSTRING 0 tmp)


CB_SelectItem(lis 0)


i hope this helps you.

Just an example how i do it.
#3
The example works great. I'm trying to wrap my head around what exactly makes it work. +Maybe a little explanation would be cool Smile+

One Exception though:
I need the list to refresh with the "cb3="&Today" option.

Code:
Copy      Help
str controls = "3 4 5 7"
str cb3 e4 e5 e7
cb3="&Today"
e7.time("MM-dd-yyyy")

I've played around with the code in the RefreshCombo function you wrote and can't get it Sad

Thanks for your help so far!
#4
your welcome, my literacy is not that clever and would be difficult for me to explain,



i hope this has solved ur problem.

Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str cb3 = "&Today"
if(!ShowDialog("DropDownDialog" &DropDownDialog &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 106 "Dialog"
;1 Button 0x54030001 0x4 4 54 48 14 "OK"
;2 Button 0x54030000 0x4 54 54 48 14 "Cancel"
;3 ComboBox 0x54230243 0x0 0 14 96 213 ""
;4 Button 0x54032000 0x0 104 14 48 14 "run"
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "" "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam

,case CBN_DROPDOWN<<16|3
,_i=CB_SelectedItem(lParam)
,RefreshCombo(id(3 hDlg))
,case IDOK
,case IDCANCEL
ret 1

Code:
Copy      Help
/
function lis


str tmp
SendMessage(lis CB_RESETCONTENT 0 0)

Dir d
foreach(d "$desktop$\*" FE_Dir)
,tmp.getfilename(d.FileName)
,SendMessage(lis CB_INSERTSTRING 0 tmp)

SendMessage(lis CB_INSERTSTRING 0 "Today")
CB_SelectItem(lis 0)
#5
Gosh that was easy!! Thanks bunches. I was trying all sorts of stuff. I thought it had to do with one of the flags on the send message. Is there any way you could break down some of the theory on this? I would love to understand it better!

Thanks so much for your help.
#6
TheVig Wrote:Gosh that was easy!! Thanks bunches. I was trying all sorts of stuff. I thought it had to do with one of the flags on the send message. Is there any way you could break down some of the theory on this? I would love to understand it better!

Thanks so much for your help.


ill give it ago,

When combo is dropped down it runs the refresh combo.

case CBN_DROPDOWN<<16|3
,_i=CB_SelectedItem(lParam)
,RefreshCombo(id(3 hDlg))

this resets the combo with nothing.
SendMessage(lis CB_RESETCONTENT 0 0)
now that its empty time to populate it

this inserts the new string with each file found,
Dir d
foreach(d "$desktop$\*" FE_Dir)
,tmp.getfilename(d.FileName)
,SendMessage(lis CB_INSERTSTRING 0 tmp)

hope that explains it a little more
#7
I dig it. It's really simple. I just didn't grab that all I had to do was populate the list with variables in the "SendMessage". I totally get it. Thank you so much for all your help. I am rockin' and a rollin' now!


Forum Jump:


Users browsing this thread: 1 Guest(s)