Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SelectedItem text
#1
i work on a macro that copies code from the flash mx actionscript editor to ultraedit (could be any other editor too).
Code:
Copy      Help
act "Macromedia Flash MX"
0.2
str s.getwintext(id(1728))

this works fine, but i want to give the new document in ultraedit a filename
and a qm comment from where is was taken -> like the frame number and
which flash document.

so i can get the index number but not the combobox text
Code:
Copy      Help
out SelectedItem(id(810 "Macromedia"))

getwintext does not work (i guess)
pi
#2
Replace SelectedItem text to text below. To save, export System folder.
Code:
Copy      Help
;/
function# hwndctrl [ctrltype] [str&itemtext];;ctrltype: 0 combobox, 1 listbox

;Returns zero based index of selected item of combo
;box or list box. If no selection, returns -1.
;Can also get selected item text.

;EXAMPLES
;1. Get item index:
;out SelectedItem(id(1136 "Open"))

;2. Get item text:
;str s
;SelectedItem(id(1136 "Open") 0 &s)
;out s


if(hwndctrl=0) ret -1
int i msg1 msg2 msg3
sel ctrltype
,case 0 msg1=CB_GETCURSEL; msg2=CB_GETLBTEXT; msg3=CB_GETLBTEXTLEN
,case 1 msg1=LB_GETCURSEL; msg2=LB_GETTEXT; msg3=LB_GETTEXTLEN
,case else end ""

i=SendMessage(hwndctrl msg1 0 0)
if(&itemtext and i>=0)
,itemtext.fix(SendMessage(hwndctrl msg2 i itemtext.all(SendMessage(hwndctrl msg3 i 0))))
ret i
#3
very well Big Grin
it does work in many programs, only that stupid flash mx +ComboBox doesn't return its string.
but i can select und get the selected index number.

can you extend the function to enumerate all indexes + strings ?
or is still there ?

what i try do, is to have a button on my own qm editor bar which
shows me a menu with all ppro command lists.
and whenever pproconf starts, the ppro_command_list.txt we will
be updated my reading the command list combo.
that would allow me to edit directly a ppro command list and
wow -> three clicks less.
pi
#4
Function GetItemText
Code:
Copy      Help
;/
function# hwndctrl item str&itemtext [ctrltype];;ctrltype: 0 combobox, 1 listbox

;Stores ComboBox or ListBox item text into str variable itemtext.
;item is zero-based item index.
;Returns 1 on success, 0 on failure.
;Does not work with controls that have "owner-draw" style.

;EXAMPLE
;str s sall; int i hwnd=id(1003 "Options")
;for i 0 GetCount(hwnd 0)
,;GetItemText hwnd i &s 0
,;sall.formata("%i. %s[]" i s)
;out sall


if(!&itemtext) end "invalid argument"
itemtext.fix(0)
int msg1 msg2
sel ctrltype
,case 0 msg1=CB_GETLBTEXT; msg2=CB_GETLBTEXTLEN
,case 1 msg1=LB_GETTEXT; msg2=LB_GETTEXTLEN
,case else end "invalid argument"

int tl=SendMessage(hwndctrl msg2 item 0); if(tl<0) ret
tl=SendMessage(hwndctrl msg1 item itemtext.all(tl)); if(tl<0) ret
itemtext.fix(tl)
ret 1

Function GetCount
Code:
Copy      Help
;/
function# hwndctrl [ctrltype]

int msg
sel(ctrltype) case 0 msg=CB_GETCOUNT; case 1 msg=LB_GETCOUNT; case else end "invalid argument"

ret SendMessage(hwndctrl msg 0 0)
#5
pi Wrote:i work on a macro that copies code from the flash mx actionscript editor to ultraedit (could be any other editor too).
Code:
Copy      Help
act "Macromedia Flash MX"
0.2
str s.getwintext(id(1728))

this works fine, but i want to give the new document in ultraedit a filename
and a qm comment from where is was taken -> like the frame number and
which flash document.

so i can get the index number but not the combobox text
Code:
Copy      Help
out SelectedItem(id(810 "Macromedia"))

getwintext does not work (i guess)


Forum Jump:


Users browsing this thread: 1 Guest(s)