SelectedItem text

Creating complex macros, dialogs, solving complex tasks, programming.

SelectedItem text

Postby _pi on Fri May 16, 2003 6:54 pm

i work on a macro that copies code from the flash mx actionscript editor to ultraedit (could be any other editor too).

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
out SelectedItem(id(810 "Macromedia"))


getwintext does not work (i guess)
_pi
Active Member
 
Posts: 1086
Joined: Tue Mar 11, 2003 12:16 am
Location: Hamburg, Germany

Postby Gintaras on Sat May 17, 2003 8:37 am

Replace SelectedItem text to text below. To save, export System folder.
;/
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

Gintaras
Site Admin
 
Posts: 5894
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Postby _pi on Sun May 18, 2003 10:21 pm

very well :D
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
Active Member
 
Posts: 1086
Joined: Tue Mar 11, 2003 12:16 am
Location: Hamburg, Germany

Postby Gintaras on Mon May 19, 2003 8:59 am

Function GetItemText
;/
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
;/
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)
Gintaras
Site Admin
 
Posts: 5894
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: SelectedItem text

Postby Guest on Wed Aug 24, 2005 3:45 am

pi wrote:i work on a macro that copies code from the flash mx actionscript editor to ultraedit (could be any other editor too).

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
out SelectedItem(id(810 "Macromedia"))


getwintext does not work (i guess)
Guest
 


Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron