Using ZEEGRID with BBC BASIC

Discussions related to the supplied tools and add-in utilities
Post Reply
ivega718
Posts: 7
Joined: Fri 15 Jun 2018, 20:28

Using ZEEGRID with BBC BASIC

Post by ivega718 » Thu 21 Jun 2018, 19:10

I am started to use this great grid control (by David Hillard ) and it is impressive. You can download the control in this link:
http://www.kycsepp.com/

If somebody can help me please about how I can capture notifications. Also if somebody can do better this code.

This is what I take from the code to use this control:

Code: Select all

      REM Sample BBCBASIC using ZEEGRID.DLL
      INSTALL @lib$+"WINLIB5"

      SYS "LoadLibrary", "ZEEGRID.DLL" TO HGRID%

      REM EQUATES FOR ZEEGRID.DLL Copyright © 2002-2016 by David Hillard
      REM http://www.kycsepp.com/
      WM_USER%=1024
      ZGM_LOADICON%                             = WM_USER% + 1
      ZGM_SETCELLICON%                          = WM_USER% + 2
      ZGM_SETROWHEIGHT%                         = WM_USER% + 3
      ZGM_SETCELLFONT%                          = WM_USER% + 4
      ZGM_SETCELLFCOLOR%                        = WM_USER% + 5
      ZGM_SETCELLBCOLOR%                        = WM_USER% + 6
      ZGM_SETTITLEHEIGHT%                       = WM_USER% + 7
      ZGM_SETCELLJUSTIFY%                       = WM_USER% + 8
      ZGM_GETCRC%                               = WM_USER% + 9
      ZGM_ENABLETBEDIT%                         = WM_USER% + 10
      ZGM_ENABLETBSEARCH%                       = WM_USER% + 11
      ZGM_SHOWTOOLBAR%                          = WM_USER% + 12
      ZGM_SHOWEDIT%                             = WM_USER% + 13
      ZGM_SHOWSEARCH%                           = WM_USER% + 14
      ZGM_GRAYBGONLOSTFOCUS%                    = WM_USER% + 15
      ZGM_ALLOCATEROWS%                         = WM_USER% + 16
      ZGM_SETAUTOINCREASESIZE%                  = WM_USER% + 17
      ZGM_APPENDROW%                            = WM_USER% + 18
      ZGM_DELETEROW%                            = WM_USER% + 19
      ZGM_SHRINKTOFIT%                          = WM_USER% + 20
      ZGM_SETRANGE%                             = WM_USER% + 21
      ZGM_GETRANGESUM%                          = WM_USER% + 22
      ZGM_SHOWTITLE%                            = WM_USER% + 23
      ZGM_ENABLESORT%                           = WM_USER% + 24
      ZGM_ENABLECOLMOVE%                        = WM_USER% + 25
      ZGM_SELECTCOLUMN%                         = WM_USER% + 26
      ZGM_DIMGRID%                              = WM_USER% + 27
      ZGM_SETROWNUMBERSWIDTH%                   = WM_USER% + 28
      ZGM_SETDEFAULTBCOLOR%                     = WM_USER% + 29
      ZGM_SETGRIDLINECOLOR%                     = WM_USER% + 30
      ZGM_SETCELLTEXT%                          = WM_USER% + 31
      ZGM_SETCOLWIDTH%                          = WM_USER% + 32
      ZGM_INSERTROW%                            = WM_USER% + 33
      ZGM_SHOWROWNUMBERS%                       = WM_USER% + 34
      ZGM_GETROWS%                              = WM_USER% + 35
      ZGM_REFRESHGRID%                          = WM_USER% + 36
      ZGM_SETDEFAULTFCOLOR%                     = WM_USER% + 37
      ZGM_SETDEFAULTFONT%                       = WM_USER% + 38
      ZGM_MERGEROWS%                            = WM_USER% + 39
      ZGM_SETDEFAULTJUSTIFY%                    = WM_USER% + 40
      ZGM_SETCELLTYPE%                          = WM_USER% + 41
      ZGM_SETCELLFORMAT%                        = WM_USER% + 42
      ZGM_SETCOLFORMAT%                         = WM_USER% + 43
      ZGM_SETCOLTYPE%                           = WM_USER% + 44
      ZGM_SETCOLJUSTIFY%                        = WM_USER% + 45
      ZGM_SETCOLFONT%                           = WM_USER% + 46
      ZGM_GETCELLINDEX%                         = WM_USER% + 47
      ZGM_ENABLETBMERGEROWS%                    = WM_USER% + 48
      ZGM_SHOWCURSORONLOSTFOCUS%                = WM_USER% + 49
      ZGM_EMPTYGRID%                            = WM_USER% + 50
      ZGM_ENABLETBROWNUMBERS%                   = WM_USER% + 51
      ZGM_GETFIXEDCOLUMNS%                      = WM_USER% + 52
      ZGM_SETCOLFCOLOR%                         = WM_USER% + 53
      ZGM_SETLEFTINDENT%                        = WM_USER% + 54
      ZGM_SETRIGHTINDENT%                       = WM_USER% + 55
      ZGM_ENABLEICONINDENT%                     = WM_USER% + 56
      ZGM_GETROWHEIGHT%                         = WM_USER% + 57
      ZGM_ENABLECOLRESIZING%                    = WM_USER% + 58
      ZGM_GETCOLWIDTH%                          = WM_USER% + 59
      ZGM_SETCOLBCOLOR%                         = WM_USER% + 60
      ZGM_SELECTROW%                            = WM_USER% + 61
      ZGM_SHOWCURSOR%                           = WM_USER% + 62
      ZGM_SETCELLEDIT%                          = WM_USER% + 63
      ZGM_GETCELLEDIT%                          = WM_USER% + 64
      ZGM_GETCURSORINDEX%                       = WM_USER% + 65
      ZGM_AUTOSIZE_ALL_COLUMNS%                 = WM_USER% + 66
      ZGM_SETCOLUMNHEADERHEIGHT%                = WM_USER% + 67
      ZGM_GETEDITEDCELL%                        = WM_USER% + 68
      ZGM_GOTOCELL%                             = WM_USER% + 69
      ZGM_SETCELLMARK%                          = WM_USER% + 70
      ZGM_MARKTEXT%                             = WM_USER% + 71
      ZGM_SETMARKTEXT%                          = WM_USER% + 72
      ZGM_ENABLETOOLBARTOGGLE%                  = WM_USER% + 73
      ZGM_HIGHLIGHTCURSORROW%                   = WM_USER% + 74
      ZGM_HIGHLIGHTCURSORROWINFIXEDCOLUMNS%     = WM_USER% + 75
      ZGM_GETROWOFINDEX%                        = WM_USER% + 76
      ZGM_GETCOLOFINDEX%                        = WM_USER% + 77
      ZGM_GETCELLTEXT%                          = WM_USER% + 78
      ZGM_SETDEFAULTEDIT%                       = WM_USER% + 79
      ZGM_SETCOLEDIT%                           = WM_USER% + 80
      ZGM_SHOWGRIDLINES%                        = WM_USER% + 81
      ZGM_ENABLEROWSIZING%                      = WM_USER% + 82
      ZGM_GETGRIDWIDTH%                         = WM_USER% + 83
      ZGM_SETCOLUMNORDER%                       = WM_USER% + 84
      ZGM_ENABLETBEXPORT%                       = WM_USER% + 85
      ZGM_ENABLETBPRINT%                        = WM_USER% + 86
      ZGM_SHOWHSCROLL%                          = WM_USER% + 87
      ZGM_SHOWVSCROLL%                          = WM_USER% + 88
      ZGM_AUTOVSCROLL%                          = WM_USER% + 89
      ZGM_AUTOHSCROLL%                          = WM_USER% + 90
      ZGM_EXPORT%                               = WM_USER% + 91
      ZGM_COMPARETEXT%                          = WM_USER% + 92
      ZGM_GETEDITTEXT%                          = WM_USER% + 93
      ZGM_SETEDITTEXT%                          = WM_USER% + 94
      ZGM_COMPARETEXT2STRING%                   = WM_USER% + 95
      ZGM_GETMOUSEROW%                          = WM_USER% + 96
      ZGM_GETMOUSECOL%                          = WM_USER% + 97
      ZGM_SETCURSORCELL%                        = WM_USER% + 98
      ZGM_CURSORFOLLOWMOUSE%                    = WM_USER% + 99
      ZGM_GETROWSPERPAGE%                       = WM_USER% + 100
      ZGM_GETTOPROW%                            = WM_USER% + 101
      ZGM_SETTOPROW%                            = WM_USER% + 102
      ZGM_AUTOSIZECOLONEDIT%                    = WM_USER% + 103
      ZGM_SETSORTLIMIT%                         = WM_USER% + 105
      ZGM_SORTONCOLDCLICK%                      = WM_USER% + 106
      ZGM_STOPWATCH_START%                      = WM_USER% + 107
      ZGM_STOPWATCH_STOP%                       = WM_USER% + 108
      ZGM_SORTCOLUMNASC%                        = WM_USER% + 109
      ZGM_SORTCOLUMNDESC%                       = WM_USER% + 110
      ZGM_GETCOLS%                              = WM_USER% + 111
      ZGM_SETSORTESTIMATE%                      = WM_USER% + 112
      ZGM_GETCELLTYPE%                          = WM_USER% + 113
      ZGM_GETCELLJUSTIFY%                       = WM_USER% + 114
      ZGM_GETCELLFCOLOR%                        = WM_USER% + 115
      ZGM_GETCELLBCOLOR%                        = WM_USER% + 116
      ZGM_GETCELLFONT%                          = WM_USER% + 117
      ZGM_GETCELLMARK%                          = WM_USER% + 118
      ZGM_GETCELLICON%                          = WM_USER% + 119
      ZGM_SETROWTYPE%                           = WM_USER% + 120
      ZGM_SETROWJUSTIFY%                        = WM_USER% + 121
      ZGM_SETROWFCOLOR%                         = WM_USER% + 122
      ZGM_SETROWBCOLOR%                         = WM_USER% + 123
      ZGM_SETROWFONT%                           = WM_USER% + 124
      ZGM_SETROWMARK%                           = WM_USER% + 125
      ZGM_SETROWICON%                           = WM_USER% + 126
      ZGM_SETROWEDIT%                           = WM_USER% + 127
      ZGM_SEARCHEACHKEYSTROKE%                  = WM_USER% + 128
      ZGM_COMBOCLEAR%                           = WM_USER% + 129
      ZGM_COMBOADDSTRING%                       = WM_USER% + 130
      ZGM_CLEARMARKONSELECT%                    = WM_USER% + 131
      ZGM_SETCOLICON%                           = WM_USER% + 132
      ZGM_SETCOLMARK%                           = WM_USER% + 133
      ZGM_SETDEFAULTTYPE%                       = WM_USER% + 134
      ZGM_SETDEFAULTMARK%                       = WM_USER% + 135
      ZGM_SETDEFAULTICON%                       = WM_USER% + 136
      ZGM_SORTSECONDARY%                        = WM_USER% + 137
      ZGM_GETSORTCOLUMN%                        = WM_USER% + 138
      ZGM_GETCURSORROW%                         = WM_USER% + 139
      ZGM_GETCURSORCOL%                         = WM_USER% + 140
      ZGM_GETSIZEOFCELL%                        = WM_USER% + 141
      ZGM_GETCELLDOUBLE%                        = WM_USER% + 142
      ZGM_SETCELLDOUBLE%                        = WM_USER% + 143
      ZGM_SETDEFAULTNUMWIDTH%                   = WM_USER% + 144
      ZGM_SETDEFAULTNUMPRECISION%               = WM_USER% + 145
      ZGM_SETCELLNUMWIDTH%                      = WM_USER% + 146
      ZGM_SETCOLNUMWIDTH%                       = WM_USER% + 147
      ZGM_SETROWNUMWIDTH%                       = WM_USER% + 148
      ZGM_SETCELLNUMPRECISION%                  = WM_USER% + 149
      ZGM_SETCOLNUMPRECISION%                   = WM_USER% + 150
      ZGM_SETROWNUMPRECISION%                   = WM_USER% + 151
      ZGM_SETCELLINT%                           = WM_USER% + 152
      ZGM_GETCELLINT%                           = WM_USER% + 153
      ZGM_INTERPRETBOOL%                        = WM_USER% + 154
      ZGM_INTERPRETNUMERIC%                     = WM_USER% + 155
      ZGM_SETCOLOR%                             = WM_USER% + 157
      ZGM_GETCOLOR%                             = WM_USER% + 158
      ZGM_SETFONT%                              = WM_USER% + 159
      ZGM_GETFONT%                              = WM_USER% + 160
      ZGM_SETPRINTPOINTSIZE%                    = WM_USER% + 161
      ZGM_GETROWSALLOCATED%                     = WM_USER% + 162
      ZGM_GETCELLSALLOCATED%                    = WM_USER% + 163
      ZGM_GETSIZEOFGRID%                        = WM_USER% + 165
      ZGM_PRINT%                                = WM_USER% + 166
      ZGM_SETITEMDATA%                          = WM_USER% + 167
      ZGM_GETITEMDATA%                          = WM_USER% + 168
      ZGM_ALTERNATEROWCOLORS%                   = WM_USER% + 169
      ZGM_UNLOCK%                               = WM_USER% + 170
      ZGM_QUERYBUILD%                           = WM_USER% + 171
      ZGM_SAVEGRID%                             = WM_USER% + 172
      ZGM_LOADGRID%                             = WM_USER% + 173
      ZGM_GETCELLTEXTLENGTH%                    = WM_USER% + 174
      ZGM_AUTOSIZECOLUMN%                       = WM_USER% + 175
      ZGM_ISGRIDDIRTY%                          = WM_USER% + 176
      ZGM_INTERPRETDATES%                       = WM_USER% + 177
      ZGM_SETCELLCDATE%                         = WM_USER% + 178
      ZGM_SETCELLJDATE%                         = WM_USER% + 179
      ZGM_GETJDATE%                             = WM_USER% + 180
      ZGM_GETCDATE%                             = WM_USER% + 181
      ZGM_GETTODAY%                             = WM_USER% + 182
      ZGM_SETREGCDATE%                          = WM_USER% + 183
      ZGM_SETREGJDATE%                          = WM_USER% + 184
      ZGM_GETREGDATEFORMATTED%                  = WM_USER% + 185
      ZGM_ISDATEVALID%                          = WM_USER% + 186
      ZGM_GETREGDATEYEAR%                       = WM_USER% + 187
      ZGM_GETREGDATEMONTH%                      = WM_USER% + 188
      ZGM_GETREGDATEDAY%                        = WM_USER% + 189
      ZGM_GETREGDATEDOW%                        = WM_USER% + 190
      ZGM_GETDOW%                               = WM_USER% + 191
      ZGM_GETDOWLONG%                           = WM_USER% + 192
      ZGM_GETDOWSHORT%                          = WM_USER% + 193
      ZGM_GETREGDATEDOY%                        = WM_USER% + 194
      ZGM_GETREGDATEWOY%                        = WM_USER% + 195
      ZGM_GETDOY%                               = WM_USER% + 196
      ZGM_GETWOY%                               = WM_USER% + 197
      ZGM_GETLASTBUTTONPRESSED%                 = WM_USER% + 198
      ZGM_ENABLECOLUMNSELECT%                   = WM_USER% + 199
      ZGM_KEEP3DONLOSTFOCUS%                    = WM_USER% + 200
      ZGM_SETLOSTFOCUSHIGHLIGHTCOLOR%           = WM_USER% + 201
      ZGM_GOTOFIRSTONSEARCH%                    = WM_USER% + 202
      ZGM_GETSELECTEDROW%                       = WM_USER% + 203
      ZGM_GETSELECTEDCOL%                       = WM_USER% + 204
      ZGM_COPYCELL%                             = WM_USER% + 205
      ZGM_GETCOLUMNORDER%                       = WM_USER% + 206
      ZGM_GETDISPLAYPOSITIONOFCOLUMN%           = WM_USER% + 207
      ZGM_GETCOLUMNINDISPLAYPOSITION%           = WM_USER% + 208
      ZGM_SCROLLDOWN%                           = WM_USER% + 209
      ZGM_SCROLLUP%                             = WM_USER% + 210
      ZGM_SCROLLRIGHT%                          = WM_USER% + 211
      ZGM_SCROLLLEFT%                           = WM_USER% + 212
      ZGM_SETBACKGROUNDBITMAP%                  = WM_USER% + 213
      ZGM_ENABLECOPY%                           = WM_USER% + 214
      ZGM_ENABLECUT%                            = WM_USER% + 215
      ZGM_ENABLEPASTE%                          = WM_USER% + 216
      ZGM_EXPANDROWSONPASTE%                    = WM_USER% + 217
      ZGM_SETCELLRESTRICTION%                   = WM_USER% + 218
      ZGM_SETROWRESTRICTION%                    = WM_USER% + 219
      ZGM_SETCOLRESTRICTION%                    = WM_USER% + 220
      ZGM_SETDEFAULTRESTRICTION%                = WM_USER% + 221
      ZGM_GETCELLRESTRICTION%                   = WM_USER% + 222
      ZGM_SETROWNUMBERFONT%                     = WM_USER% + 223
      ZGM_SETGRIDBGCOLOR%                       = WM_USER% + 224
      ZGM_GETCELLFORMAT%                        = WM_USER% + 225
      ZGM_SHOWCOPYMENU%                         = WM_USER% + 226
      ZGM_ADJUSTHEADERS%                        = WM_USER% + 227
      ZGM_ENABLETRANSPARENTHIGHLIGHTING%        = WM_USER% + 228
      ZGM_GETCELLADVANCE%                       = WM_USER% + 229
      ZGM_SETCELLADVANCE%                       = WM_USER% + 230
      ZGM_SETCOLADVANCE%                        = WM_USER% + 231
      ZGM_SETROWADVANCE%                        = WM_USER% + 232
      ZGM_SETDEFAULTADVANCE%                    = WM_USER% + 233
      ZGM_GETCELLINTSAFE%                       = WM_USER% + 234
      ZGM_GETROWNUMBERSWIDTH%                   = WM_USER% + 235
      ZGM_SPANCOLUMN%                           = WM_USER% + 236
      ZGM_GETAUTOINCREASESIZE%                  = WM_USER% + 237

      REM  NOTIFICATION MESSAGES       ////////

      ZGN_MOUSEMOVE%              =  1
      ZGN_SORT%                   =  2
      ZGN_CURSORCELLCHANGED%      =  3
      ZGN_EDITEND%                =  4
      ZGN_RIGHTCLICK%             =  5
      ZGN_LOADCOMBO%              =  6
      ZGN_INSERT%                 =  7
      ZGN_DELETE%                 =  8
      ZGN_F1%                     =  9
      ZGN_F2%                     = 10
      ZGN_F3%                     = 11
      ZGN_F4%                     = 12
      ZGN_F5%                     = 13
      ZGN_F6%                     = 14
      ZGN_F7%                     = 15
      ZGN_F8%                     = 16
      ZGN_EDITCOMPLETE%           = 17
      ZGN_DOUBLECLICKREADONLY%    = 18
      ZGN_DOUBLECLICKFIXEDCOLUMN% = 19
      ZGN_SORTCOMPLETE%           = 20
      ZGN_BUTTONPRESSED%          = 21
      ZGN_CELLCLICKED%            = 22
      ZGN_COLUMNMOVED%            = 23
      ZGN_PASTECOMPLETE%          = 24
      ZGN_GOTFOCUS%               = 25
      ZGN_LOSTFOCUS%              = 26
      ZGN_ROWSELECTED%            = 27
      REM  FILE EXPORT FLAGS
      EF_FILENAMESUPPLIED%  = 1
      EF_DELIMITERSUPPLIED% = 2
      EF_SILENT%            = 4
      EF_NOHEADER%          = 8
      REM  TEXT JUSTIFICATION CONSTANTS
      LEFT_SINGLE%   =  1
      CENTER_SINGLE% =  4
      RIGHT_SINGLE%  =  7
      LEFT_MULTI%    =  9
      CENTER_MULTI%  = 10
      RIGHT_MULTI%   = 11

      GCOL 1
      GCOL 135
      CLG


      ZEEGRID1%=FN_createwindow("zeegrid","ZEEGRID Control",0,0,900,600,12,&96,0)

      REM Dimension to 100 rows and 26 columns
      SYS "SendMessage", ZEEGRID1%,ZGM_DIMGRID%, 26, 0
      SYS "SendMessage", ZEEGRID1%,ZGM_SHOWROWNUMBERS%, 1, 0
      SYS "SendMessage", ZEEGRID1%,ZGM_ALLOCATEROWS% , 100, 0

      REM Put title to colums (A-Z)
      FOR Y=1 TO 26
        CUAL=Y+64
        LCOLUMN$=CHR$(CUAL)+CHR$(13)
        SYS "SendMessage", ZEEGRID1%, ZGM_SETCELLTEXT%, Y, LCOLUMN$
      NEXT Y
      REM Append rows 1 TO 100
      FOR I% = 1 TO 100
        SYS "SendMessage", ZEEGRID1%, ZGM_APPENDROW%, 0,0
      NEXT I%

      REM Set the type of column for Column 1 and 2 and set EDITABLE:
      SYS "SendMessage", ZEEGRID1%, ZGM_SETCOLTYPE%, 1, 2
      SYS "SendMessage", ZEEGRID1%, ZGM_SETCOLEDIT%, 1, 1
      SYS "SendMessage", ZEEGRID1%, ZGM_SETCOLTYPE%, 2, 2
      SYS "SendMessage", ZEEGRID1%, ZGM_SETCOLEDIT%, 2, 1

      REM Set text in CELL 1,3  Row 1, Col 3
      SYS "SendMessage", ZEEGRID1%,ZGM_GETCELLINDEX%,1,3 TO CELL%
      TEXT$="Push this Button"
      SYS "SendMessage", ZEEGRID1%,ZGM_SETCELLTEXT%,CELL%,TEXT$

      REM Set type button for column 3
      SYS "SendMessage", ZEEGRID1%, ZGM_SETCOLTYPE%, 3, 5
      SYS "SendMessage", ZEEGRID1%, ZGM_SETCOLEDIT%, 3, 1

      REM Set type checkbox for column 4
      SYS "SendMessage", ZEEGRID1%, ZGM_SETCOLTYPE%, 4, 1
      SYS "SendMessage", ZEEGRID1%, ZGM_SETCOLEDIT%, 4, 1


      SYS "SendMessage", ZEEGRID1%,ZGM_ENABLETOOLBARTOGGLE% ,1, 0
      SYS "SendMessage", ZEEGRID1%,ZGM_SHOWTOOLBAR% ,1, 0
      SYS "SendMessage", ZEEGRID1%,ZGM_SHOWEDIT% ,1, 0
      SYS "SendMessage", ZEEGRID1%,ZGM_ENABLECOPY% ,1, 0
      SYS "SendMessage", ZEEGRID1%,ZGM_SETCOLFONT% ,1, 110
      SYS "SendMessage", ZEEGRID1%,ZGM_SETROWNUMBERFONT% ,110

      SYS "SendMessage", ZEEGRID1%,ZGM_GETCELLINDEX%,1,1 TO CELL%
      SYS "SendMessage", ZEEGRID1%,ZGM_SETCELLTEXT%,CELL%,"This is a Test with ZEEGRID and BBC BASIC"

      SYS "SendMessage", ZEEGRID1%,ZGM_GETCELLINDEX%,2,1 TO CELL%
      SYS "SendMessage", ZEEGRID1%,ZGM_SETCELLTEXT%,CELL%,"Hello World"


      REM Set text into cells
      FOR ROW%=1 TO 100
        SYS "SendMessage", ZEEGRID1%,ZGM_GETCELLINDEX%,ROW%,2 TO CELL%
        TEXT$="ROW: "+STR$(ROW%)
        SYS "SendMessage", ZEEGRID1%,ZGM_SETCELLTEXT%,CELL%,TEXT$
      NEXT ROW%

      REM Set color in cells Fore and Background
      ROW%=5:COL%=2
      SYS "SendMessage", ZEEGRID1%,ZGM_GETCELLINDEX%,ROW%,COL% TO CELL%
      SYS "SendMessage", ZEEGRID1%,ZGM_SETCELLBCOLOR% ,CELL%, 6
      SYS "SendMessage", ZEEGRID1%,ZGM_SETCELLFCOLOR% ,CELL%, 4

      ROW%=7:COL%=2
      SYS "SendMessage", ZEEGRID1%,ZGM_GETCELLINDEX%,ROW%,COL% TO CELL%
      SYS "SendMessage", ZEEGRID1%,ZGM_SETCELLBCOLOR% ,CELL%, 2
      SYS "SendMessage", ZEEGRID1%,ZGM_SETCELLFCOLOR% ,CELL%, 4

      REM Set AutoSize for 3 columns
      SYS "SendMessage", ZEEGRID1%,ZGM_AUTOSIZECOLUMN% ,1, 0
      SYS "SendMessage", ZEEGRID1%,ZGM_AUTOSIZECOLUMN% ,2, 0
      SYS "SendMessage", ZEEGRID1%,ZGM_AUTOSIZECOLUMN% ,3, 0

      q$=GET$
      PROC_closewindow(ZEEGRID1%)
      END

SampleZEEGRID.jpg
SampleZEEGRID.jpg (149.54 KiB) Viewed 1835 times

Zaphod
Posts: 39
Joined: Sat 23 Jun 2018, 15:51

Re: Using ZEEGRID with BBC BASIC

Post by Zaphod » Sat 23 Jun 2018, 16:23

Getting access to the notifications is relatively easy.

First you have to get rid of that q$=GET$, GET$ blocks interrupts so you won't get any notifications!
The easiest way is probably to replace that code with REPEAT UNTIL INKEY(10)<>-1 in this demo.

Next to get the events you can use ON SYS or in a simple example just use the FN_setproc() function that is part of WINLIB5 that you have already loaded. Your construction of the grid would then change to:

Code: Select all

ZEEGRID1%=FN_createwindow("zeegrid","ZEEGRID Control",0,0,900,600,FN_setproc(PROCgridevent()),&96,0)
Then you need to write the PROCgridevent to detect the notification code and direct the action code. That would go something like this:

Code: Select all

  DEF PROCgridevent(W%, L%)
      LOCAL event%
      event%= W%>>16
      CASE event% OF
    
        WHEN ZGN_MOUSEMOVE% : REM some action code
        WHEN ZGN_SORT%      :
          REM etc add event handlers as needed.
          REM ZGN_CURSORCELLCHANGED%      =  3
          REM ZGN_EDITEND%                =  4
          REM ZGN_RIGHTCLICK%             =  5
          REM ZGN_LOADCOMBO%              =  6
          REM ZGN_INSERT%                 =  7
          REM ZGN_DELETE%                 =  8
          REM ZGN_F1%                     =  9
          REM ZGN_F2%                     = 10
          REM ZGN_F3%                     = 11
          REM ZGN_F4%                     = 12
          REM ZGN_F5%                     = 13
          REM ZGN_F6%                     = 14
          REM ZGN_F7%                     = 15
          REM ZGN_F8%                     = 16
          REM ZGN_EDITCOMPLETE%           = 17
          REM ZGN_DOUBLECLICKREADONLY%    = 18
          REM ZGN_DOUBLECLICKFIXEDCOLUMN% = 19
          REM ZGN_SORTCOMPLETE%           = 20
        WHEN ZGN_BUTTONPRESSED%: REM .....
        WHEN ZGN_CELLCLICKED%  : REM do something?
          REM ZGN_COLUMNMOVED%            = 23
          REM ZGN_PASTECOMPLETE%          = 24
          REM ZGN_GOTFOCUS%               = 25
          REM ZGN_LOSTFOCUS%              = 26
          REM ZGN_ROWSELECTED%            = 27
      ENDCASE

      ENDPROC
      
As the author points out most of those notifications won't be used very often if at all.
One point however to note is that the FN_setproc does not have any buffering so you might run into trouble with missing notifications if they happen quickly and your code is slow. I notice that some functions of the grid are quite slow so you might get into trouble. To help you might consider using the event library that I detailed in the Conforums pages here: Alt event library which would ensure that you captured all events. But for very simple demo applications that is probably overkill. The manual/wiki has notes about handling of interrupts that you might browse through before you go too much further.
Good luck, and thanks for bringing this control grid to our attention. It looks like it could be a very useful interface.

Z

ivega718
Posts: 7
Joined: Fri 15 Jun 2018, 20:28

Re: Using ZEEGRID with BBC BASIC

Post by ivega718 » Tue 26 Jun 2018, 04:35

Thank you Zaphod...I will test with you sample.

Zaphod
Posts: 39
Joined: Sat 23 Jun 2018, 15:51

Re: Using ZEEGRID with BBC BASIC

Post by Zaphod » Tue 26 Jun 2018, 14:21

The simplest way to prove it works is to write the notification it detects back to the grid somewhere in PROCgridevent.

Code: Select all

SYS "SendMessage", ZEEGRID1%,ZGM_SETCELLTEXT%,CELL%,STR$event%
Quite often the notification number is quickly overwritten by the next notification so does not stick around. To prove that notification actually occurs you would put the code into the particular CASE.
Has anyone else tried this control yet? It has some interesting features. Cells can be buttons, list boxes or combo boxes and contain icons so can make some quite nice user interfaces without having to say use COMLIB and Excel.
And no I am not the Z in ZeeGrid but I have tried several other grid controls in the past and this is perhaps the simplest to use if you are not requiring to bind it to a database. (Because it doesn't do that!)

Z

DDRM
Administrator
Posts: 72
Joined: Mon 02 Apr 2018, 18:04

Re: Using ZEEGRID with BBC BASIC

Post by DDRM » Wed 27 Jun 2018, 08:26

Agreed: ZEEGRID looks potentially a very powerful tool!

D

Post Reply