Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
qm_grid and ICsv
#5
I needed almost the exact same code for a macro, but I can't get the following working
  • When a cell is edited, it's font-color becomes red and font style becomes bold (only the cell not the whole row).
  • When the 'SAVE' button is clicked all goes back to blue and normal (with normal I mean, none-bold)

The grid is initially loaded with a blue courrier font, this I could do but the 2 things above I can not get right.

The code is almost exact the same as you have given I only changed:
- user can edit cells
- initial font type and color is changed
- added a button called 'SAVE' (when this button get's clicked everything reverts back to the initial style => blue, none-bold)

The slightly changed code below:

Function dialog_grid_ping_ip
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str qmg3x
if(!ShowDialog("dialog_grid_ping_ip" &dialog_grid_ping_ip &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 QM_Grid 0x56031041 0x0 0 0 224 114 "0x2,0,0,0,0x0[]Computer name,,,[]IP,,,"
;4 Button 0x54032000 0x0 68 116 48 14 "SAVE"
;END DIALOG
;DIALOG EDITOR: "" 0x203050C "*" "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG goto gInit
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto gNotify
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
;_______________________

;gInit

;; ======= BEGIN: INITIAL FONT SETTINGS
__Font-- f
f.Create("Courier New" 10 0)
f.SetDialogFont(hDlg "3")

int hlv=id(3 hDlg)
SendMessage hlv LVM_SETTEXTCOLOR 0 0xff0000
;; ======= END: INITIAL FONT SETTINGS

str csv=
;test1,192.168.0.1
;tes21,192.168.0.2
;test3,192.168.0.3

ICsv- t_csv=CreateCsv(1)
t_csv.FromString(csv)
t_csv.ToQmGrid(id(3 hDlg))

ret
;_______________________

;gNotify
NMHDR* nh=+lParam
sel nh.idFrom
,case 3
,NMITEMACTIVATE* na=+nh
,sel nh.code
,,case NM_CLICK ;;when user clicks a row or empty space, and it does not begin cell edit mode
,,if(na.iItem<0) ret
,,;out "row click: %i %i" na.iItem na.iSubItem
,,str IP=t_csv.Cell(na.iItem 1)
,,mes IP


Messages In This Thread

Forum Jump:


Users browsing this thread: 6 Guest(s)