Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pass items in two combo boxes
#2
single left click left combo to select item. Double left click right combo to open and goto code. Edit button is not needed


Function Dialog_Edit_Autotext
Code:
Copy      Help
out
str s.getsel
QMITEM q; int i
ARRAY(str) atn
rep
,i=qmitem(-i 1|16 &q 1)
,if(i=0) break
,if q.itype=4
,,atn[]=q.name
_s=atn
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 334 188 "Edit Existing AutoText"
;3 ComboBox 0x54230641 0x0 11 8 120 173 ""
;4 ComboBox 0x54230641 0x0 145 8 174 172 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""

str controls = "3 4"
str cb3 cb4
cb3=_s
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,CB_SelectString(id(3 hDlg) "test")
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
int hcb2=id(4 hDlg) ;;combo box
sel wParam
,case IDOK
,case IDCANCEL
,case 10 ;;Add
,DT_Ok hDlg
,case CBN_SELENDOK<<16|3
,str cb1si
,_i=CB_SelectedItem(lParam cb1si)
,str cb2ii itemscb2=sub.gotoitemedit(cb1si)
,SendMessage(hcb2 CB_RESETCONTENT 0 0)
,itemscb2.findreplace(":sub." "     ")
,itemscb2.findreplace(";;" "     ")
,foreach cb2ii itemscb2
,,CB_Add(hcb2 cb2ii)    
,case CBN_DBLCLK<<16|4
,str cb2t
,_i=CB_SelectedItem(lParam cb2t)
,_s.getwintext(id(3 hDlg))
,mac+ _s
,int c=GetQmCodeEditor
,SendMessage(c SCI.SCI_GOTOLINE _i+1 0)
,int ii=findrx(cb2t "Sub." 0 1)
,int cp=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
,cp+ii
,SendMessage(c SCI.SCI_GOTOPOS cp 0)    
ret 1


#sub gotoitemedit
function~ ~name

str pattern="(?:.*\:sub\..*)"

_s.getmacro(name 0)
str ss d
int i
ARRAY(str) a
findrx(_s pattern 0 4 a)
for i 0 a.len
,d.formata("%s[]" a[0 i])

ret d.trim


Messages In This Thread
Pass items in two combo boxes - by win - 04-20-2019, 01:21 AM
RE: Pass items in two combo boxes - by Kevin - 04-20-2019, 01:49 AM
RE: Pass items in two combo boxes - by win - 04-20-2019, 02:04 AM
RE: Pass items in two combo boxes - by Kevin - 04-20-2019, 02:11 AM
RE: Pass items in two combo boxes - by win - 04-20-2019, 02:22 AM
RE: Pass items in two combo boxes - by win - 04-20-2019, 10:23 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)