Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Image grid and sqlite
#1
Hello,

I'm new with Quick Macros, I am interested to use images in a grid with sqlite.

I am using sample_Grid_images and sample_Grid_Sqlite to do this:

Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam

Shows how to use grid control with Sqlite database.

if(hDlg) goto messages

str- t_dbfile="$desktop$\lp1.db3"
Sqlite- t_db
________________________________________________

if !FileExists(t_dbfile) ;;create database for testing
    Sqlite CopyNote.Open(t_dbfile)
    str sql=
     CREATE TABLE table1 (ID PRIMARY KEY, TYPE, INFO);
     INSERT INTO table1 VALUES
     (<//1>,'LOGIN','Extra'),
     (<//2>,'DIVERS','that work'),
     (<//3>,'DIVERS','Good !');
    CopyNote.Exec(sql)
    CopyNote.Close
________________________________________________


if(!ShowDialog("" &Function1)) ret

BEGIN DIALOG
0 "" 0x90C80AC8 0x0 0 0 338 174 "Dialog"
3 QM_Grid 0x54030000 0x0 2 6 334 126 ""
1 Button 0x54030001 0x4 2 156 48 14 "OK"
2 Button 0x54030000 0x4 54 156 48 14 "Cancel"
4 Static 0x54000000 0x0 176 156 160 13 "Click a cell, add text. OK will save the changes."
END DIALOG
DIALOG EDITOR: "" 0x2040003 "" "" "" ""

ret
messages
DlgGrid g.Init(hDlg 3)

sel message
    case WM_INITDIALOG
    
     add columns to the grid control, if not added in dialog editor
    g.ColumnsAdd("ID,100,,0[]TYPE,100,1,[]INFO,,,0" 1)
     open database and add table1 to the grid control
    t_db.Open(t_dbfile)
    t_db.ToQmGrid(g "SELECT * FROM table1")
    
    __ImageList- il.Load("$qm$\il_dlg.bmp")
    il.SetOverlayImages("0 1")
    g.SetImagelist(il il)
    
    case WM_DESTROY
    case WM_COMMAND goto messages2
    case WM_NOTIFY goto messages3
ret
messages2
sel wParam
    case IDOK
     save changes
    t_db.FromQmGrid(g "table1" 2)
ret 1

messages3

But I don't see images in my first column, juste <//1>...<//2>...

How to do that ?

Sincerely,

Laurent


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)