Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamically create SysListView
#33
this version is with QM Grid. Don't need function DynamicLVKeys with this.

everything works accept tab. Can't make work with grid. So, you will have to use enter instead of tab.
Function DynamicLV2
Code:
Copy      Help
;/
function# str'text [flags];;optional .1 show dialog at caret position if possible. 0 or omitted show dialog at center of screen(default)
int w1=win()
RECT r1; DpiGetWindowRect w1 &r1
int iid to=Statement(1 0 0 iid)
str ss.getmacro(iid)
ss.left(ss to)
if(flags&1)
,int xx yy isCaret
,isCaret = GetCaretXY(xx yy)

str dd=
;BEGIN DIALOG
;0 "" 0x90080AC8 0x0 0 0 184 108 "" "4"
;3 QM_Grid 0x5603504D 0x200 0 0 184 108 "0x13,0,0,0x4,0x0[]"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

str controls = "3"
str qmg3x
int iii= ShowDialog(dd &sub.DlgProc &controls)
ret iii

#sub DlgProc v
function# hDlg message wParam lParam
DlgGrid g.Init(hDlg 3)
sel message
,case WM_INITDIALOG
,__Font- f.CreateNew(g.hwnd "Segoe UI" 12) ;;change this
,f.SetDialogFont(hDlg "3")
,g.ColumnsAdd(",90%[],10%")
,int n=numlines(text)
,for int'i 0 n
,,_s.getl(text i)
,,TO_LvAdd g.hwnd i 0 0 _s i+1
,RECT r.left=LVIR_BOUNDS; SendMessage(g.hwnd LVM_GETITEMRECT 0 &r)
,int xy=SendMessage(g.hwnd LVM_APPROXIMATEVIEWRECT n -1|-1)
,int width = xy & 0x0000FFFF
,int hh = xy>>16&0x0000FFFF
,siz width+4 hh g.hwnd
,siz width+11 hh-r.bottom+8 hDlg
,if(isCaret > 0) ;; if caret is found  and flag is 1 move dialog to caret
,,mov xx yy+25 hDlg
,else
,,int Dwidth Dheight
,,GetWinXY hDlg 0 0 Dwidth Dheight
,,int Dx = r1.left + ((r1.right - r1.left - Dwidth)/2)
,,int Dy = r1.top + ((r1.bottom - r1.top - Dheight)/2)
,,mov Dx Dy hDlg    
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3    
ret
;messages2
sel wParam
,case IDOK
,int ii=SendDlgItemMessage(hDlg 3 LVM_GETNEXTITEM -1 LVNI_SELECTED)
,DT_EndDialog(hDlg ii)    
,case IDCANCEL
,DT_EndDialog(hDlg 1000)
ret 1
;messages3
NMHDR* nh=+lParam
sel nh.idFrom
,case 3
,GRID.QM_NMLVDATA* cd=+nh
,NMLVDISPINFO* di=+nh
,NMLISTVIEW* nlv=+nh
,NMITEMACTIVATE* na=+nh
,sel nh.code
,,case NM_DBLCLK ;;when user clicks a row or empty space, and it does not begin cell edit mode
,,DT_EndDialog(hDlg na.iItem)
,,case NM_RCLICK
,,str lviText.getl(text na.iItem)
,,int posF=find(ss lviText 0)
,,mac "sub.CloseMenu"
,,mac "sub.FlashCodeLine" "" posF iid
,,DT_EndDialog(hDlg 1000)
,,ret 0
,,case LVN_KEYDOWN
,,NMLVKEYDOWN* lvk=+nh
,,if lvk.wVKey =188;; key ,
,,,SendMessage(g.hwnd WM_KEYDOWN VK_DOWN 0)
,,,ret 1
,,if lvk.wVKey =190    ;; key .
,,,SendMessage(g.hwnd WM_KEYDOWN VK_UP 0)
,,,ret 1
,,if lvk.wVKey=191;; key /
,,,DT_EndDialog(hDlg 1000)
,,if(lvk.wVKey>64 or lvk.wVKey<91)
,,,str gg
,,,QmKeyCodeFromVK lvk.wVKey gg
,,,opt waitmsg 1
,,,int ln dc=sub.CheckForUnique(text lvk.wVKey ln)
,,,act hDlg
,,,if dc>1
,,,,int row
,,,,for row 0 g.RowsCountGet
,,,,,str s=g.CellGet(row 0)
,,,,,if s.begi(gg)
,,,,,,int rs=g.RowSelectedGet
,,,,,,if rs=row
,,,,,,,continue
,,,,,,else
,,,,,,,g.RowSelect(row)
,,,,,,,break
,,,if dc=1
,,,,DT_EndDialog(hDlg ln)

#sub CheckForUnique
function ~text keys &ln
;out keys
int count
for _i 0 numlines(text)
,_s.getl(text _i)
,if(_s[0] = keys)
,,ln=_i
,,count+1
ret count

#sub FlashCodeLine
function curPos iid [hce]
if(!hce) hce=GetQmCodeEditor
mac+ iid
act hce
SendMessage hce SCI.SCI_GOTOPOS curPos 0
int indicator=19
SendMessage(hce SCI.SCI_SETINDICATORCURRENT indicator 0)
SendMessage(hce SCI.SCI_INDICSETALPHA indicator 100)
SendMessage(hce SCI.SCI_INDICSETFORE indicator 0x00FF00)
SendMessage(hce SCI.SCI_INDICSETSTYLE indicator SCI.INDIC_STRAIGHTBOX)
SendMessage(hce SCI.SCI_INDICSETUNDER indicator TRUE)
int line=SendMessage(hce SCI.SCI_LINEFROMPOSITION curPos 0)
int lep=SendMessage(hce SCI.SCI_GETLINEENDPOSITION line 0)
act hce
rep 4
,SendMessage(hce SCI.SCI_INDICATORFILLRANGE curPos lep-curPos)
,0.25
,SendMessage(hce SCI.SCI_INDICATORCLEARRANGE curPos lep-curPos)
,0.25
SendMessage(hce SCI.SCI_SETINDICATORCURRENT 0 0)

#sub CloseMenu
int w=wait(0 WV win("" "#32768"))
clo w


Messages In This Thread
Dynamically create SysListView - by Davider - 08-18-2022, 03:15 AM
RE: Dynamically create SysListView - by Davider - 08-18-2022, 09:05 AM
RE: Dynamically create SysListView - by Gintaras - 08-18-2022, 09:19 AM
RE: Dynamically create SysListView - by Kevin - 08-19-2022, 11:31 PM
RE: Dynamically create SysListView - by Davider - 08-20-2022, 12:49 AM
RE: Dynamically create SysListView - by Kevin - 08-20-2022, 03:44 AM
RE: Dynamically create SysListView - by Davider - 08-20-2022, 10:28 AM
RE: Dynamically create SysListView - by Kevin - 08-20-2022, 11:51 AM
RE: Dynamically create SysListView - by Davider - 08-20-2022, 12:10 PM
RE: Dynamically create SysListView - by Davider - 08-20-2022, 11:13 PM
RE: Dynamically create SysListView - by Gintaras - 08-21-2022, 11:35 AM
RE: Dynamically create SysListView - by Davider - 08-21-2022, 12:41 PM
RE: Dynamically create SysListView - by Davider - 08-21-2022, 09:41 PM
RE: Dynamically create SysListView - by Gintaras - 08-22-2022, 11:45 AM
RE: Dynamically create SysListView - by Davider - 08-22-2022, 12:42 PM
RE: Dynamically create SysListView - by Gintaras - 08-22-2022, 01:11 PM
RE: Dynamically create SysListView - by Davider - 08-22-2022, 02:08 PM
RE: Dynamically create SysListView - by Kevin - 08-23-2022, 03:30 AM
RE: Dynamically create SysListView - by Davider - 08-23-2022, 09:40 AM
RE: Dynamically create SysListView - by Davider - 11-04-2022, 02:05 AM
RE: Dynamically create SysListView - by Kevin - 11-04-2022, 05:31 AM
RE: Dynamically create SysListView - by Davider - 11-04-2022, 05:57 AM
RE: Dynamically create SysListView - by Kevin - 11-04-2022, 02:45 PM
RE: Dynamically create SysListView - by Davider - 11-07-2022, 12:19 PM
RE: Dynamically create SysListView - by Kevin - 11-17-2022, 01:37 AM
RE: Dynamically create SysListView - by Davider - 11-25-2022, 04:34 AM
RE: Dynamically create SysListView - by Kevin - 11-27-2022, 02:19 AM
RE: Dynamically create SysListView - by Davider - 11-27-2022, 02:44 AM
RE: Dynamically create SysListView - by Davider - 12-02-2022, 02:24 AM
RE: Dynamically create SysListView - by Davider - 12-02-2022, 12:31 PM
RE: Dynamically create SysListView - by Kevin - 12-02-2022, 05:42 PM
RE: Dynamically create SysListView - by Davider - 12-02-2022, 09:14 PM
RE: Dynamically create SysListView - by Kevin - 12-10-2022, 03:09 AM
RE: Dynamically create SysListView - by Davider - 12-10-2022, 10:47 PM
RE: Dynamically create SysListView - by Davider - 03-26-2023, 02:16 AM
RE: Dynamically create SysListView - by Kevin - 03-27-2023, 01:29 AM
RE: Dynamically create SysListView - by Davider - 03-27-2023, 02:26 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)