I'll do something about it!
egrid 4 grid gadget - (static PB library version.)
Rename egrid_Resident.pbi to egrid_Resident.pb 
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

10th November 2006.
Release version 1.2 now available.
A bug with the #egrid_MakeCellVisible() has been fixed.
Also, an extra demo program (7) has been added to show how to use a CellCallback function to validate (and control) cell navigation.
Specifically, the example refuses to allow cells in column 0 to be selected (except to allow the checkmarks to be toggled) but is careful to ensure that the column remains visible following an attempt to select a cell in this column etc. (This is an important consideration.)
Also, the example only allows one checkbox to be set at a time. This could be useful for certain applications.
(Have also ensured that the resident file is named correctly!
)
http://www.purecoder.net/egrid.htm
Release version 1.2 now available.
A bug with the #egrid_MakeCellVisible() has been fixed.
Also, an extra demo program (7) has been added to show how to use a CellCallback function to validate (and control) cell navigation.
Specifically, the example refuses to allow cells in column 0 to be selected (except to allow the checkmarks to be toggled) but is careful to ensure that the column remains visible following an attempt to select a cell in this column etc. (This is an important consideration.)
Also, the example only allows one checkbox to be set at a time. This could be useful for certain applications.
(Have also ensured that the resident file is named correctly!
http://www.purecoder.net/egrid.htm
I may look like a mule, but I'm not a complete ass.
After deleting egrid_Resident.res it works fine 
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

My apologies, but demo 7 has a bug in it. (See release version 1.2)
Here's the corrected version:
Here's the corrected version:
Code: Select all
;******************************************************************************************
;'egrid4' editable grid control. By Stephen Rodriguez.
;******************************************************************************************
; DEMONSTRATION PROGRAM 7.
;******************************************************************************************
;This demo program sets up an egrid which shows how to use a Cellcallback funtion to validate
;cell selection etc.
;******************************************************************************************
;XIncludeFile "egrid4.pb"
DisableExplicit
Global gLastOption
LoadFont(1, "Arial", 10)
;************************************CELLCALLBACK FUNCTION*********************************
;NOTE, THIS IS NOT A PROPER WINDOWS CALLBACK!
Procedure.l MyCellCallBack(egrid, uMsg, *cellinfo.egridCellInfo)
Protected result
Select uMsg
Case #egrid_CellUpdated
If *cellinfo\column = 0
If gLastOption<>-1 And gLastOption <> *cellinfo\row
egrid_SetCellText ( 1, 0, gLastOption, "FALSE" )
EndIf
gLastOption=*cellinfo\row
EndIf
result=1
Case #egrid_SelectCell
result=1
If *cellinfo\column=0
Select *cellinfo\param ;Informs us how the user attempted to select the cell.
Case #egrid_LeftClick
egrid_MakeCellVisible(1, 0, *cellinfo\row)
result=0 ;Refuse the selection.
Case #egrid_ShiftTab
If *cellinfo\row>0
*cellinfo\row-1
*cellinfo\column=egrid_NumberOfColumns(1)-1
Else
egrid_MakeCellVisible(1, 0, *cellinfo\row)
result=0 ;Refuse the selection.
EndIf
Default
egrid_MakeCellVisible(1, 0, *cellinfo\row)
*cellinfo\column=1
EndSelect
EndIf
Case #egrid_NotifyCellType
Select *cellinfo\column
Case 0
*cellinfo\celltype=#egrid_CheckBox
*cellinfo\text="TRUE/FALSE"
EndSelect
Default
result = #True ;This accounts for all messages we have decided not to process.
EndSelect
ProcedureReturn result
EndProcedure
;******************************************************************************************
;*************************************WINDOW + GADGET LIST*********************************
If OpenWindow(0,0,0,640,300,"egrid4 demo 7.",#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_Maximize|#PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
;******************************************************************************************
text$="The following grid only allows one checkmark to be set at any one time."
text$+Chr(13)+Chr(10)+Chr(13)+Chr(10)+"It also does not allow any cell in column 0 to be selected."
text$+" When doing this you need to take care with validating cell navigation to ensure that column 0 remains visible."
text$+Chr(13)+Chr(10)+Chr(13)+Chr(10)+"Both of these features are controlled within a CellCallback function."
TextGadget(0, WindowWidth(0)/12,20, 800, 120, text$)
SetGadgetFont(0, FontID(1))
;********************************************EGRID*****************************************
;Create an egrid with resizable columns.
egrid_CreateGrid(1, WindowWidth(0)/2-175, 150, 350, 300,24,#egrid_GridLines|#egrid_AlwaysShowSelection, #egrid_ResizeColumnsTrue|#egrid_MultiLineText)
text$="NOTE that this would need re-coding if we allowed the user to reorder the columns by click and drag etc."
TextGadget(2, WindowWidth(0)/12,500, 800, 120, text$)
SetGadgetFont(2, FontID(1))
;**********************************SET CELLCALLBACK FUNCTION*******************************
;Set the callback early to avoid massive flickering when populating the egrid with initial data.
egrid_CreateCellCallback(1, @MyCellCallBack())
;******************************************************************************************
;***************************************ADD DATA TO EGRID**********************************
egrid_AddColumn(1,0,"",30)
egrid_AddColumn(1,1,"First name",120)
egrid_AddColumn(1,2,"Second name",120)
egrid_AddColumn(1,3,"Gender",60)
egrid_AddColumn(1,4,"VR",30)
For b=0 To 80 ; Add 100 rows.
egrid_AddRow(1,-1)
egrid_SetCellText(1,0,b,"FALSE")
egrid_SetCellText(1,1,b,"Bob")
egrid_SetCellText(1,2,b,"Smith")
Next
egrid_SetHeaderHeight(1,40)
egrid_SetOptions(1, -1, -1, 2,-1) ; gadgetnum, header border colour, selection border colour, selection border width, gridline colour
SetActiveGadget(1)
;******************************************************************************************
;*****************************************EVENT LOOP***************************************
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
Until EventID = #PB_Event_CloseWindow
EndIf
End
I may look like a mule, but I'm not a complete ass.
12th November 2006.
Due to a fraudulent payment (with what looks like a stolen credit card), I've taken the library down whilst I alter all registration codes etc.
I will e-mail all registered users with new reg codes when appropriate etc.
The library will be reinstated later tonight.
My apologies, but such is the way of the world! This will obviously not affect current users until you wish to download an updated version etc.
Due to a fraudulent payment (with what looks like a stolen credit card), I've taken the library down whilst I alter all registration codes etc.
I will e-mail all registered users with new reg codes when appropriate etc.
The library will be reinstated later tonight.
My apologies, but such is the way of the world! This will obviously not affect current users until you wish to download an updated version etc.
I may look like a mule, but I'm not a complete ass.
- Thorsten1867
- Addict

- Posts: 1372
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
I don't if it's possible, but I'm looking for a way to check a doubleclick on a egrid row.
The first column is static (not selectable) and I want call a file requester after doubleclick to change the content (filename).
(the second column is editable)
Perhaps you can take a look to the current version of EasySetup (Upload HTML pages) to see, what I need
The first column is static (not selectable) and I want call a file requester after doubleclick to change the content (filename).
(the second column is editable)
Perhaps you can take a look to the current version of EasySetup (Upload HTML pages) to see, what I need
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
At the moment, a single click results in a cell being selected. Because a double-click first results in a #WM_LBUTTONDOWN event anyhow, and thus causes a cell to be selected, I didn't see any need to add a #egrid_LeftDoubleClick to the #egrid_SelectCell message.
However, I can add this if you wish, even though it would be useless for detecting a cell select because this is notified as soon as a #WM_LBUTTONDOWN message is generated.
However, I can add this if you wish, even though it would be useless for detecting a cell select because this is notified as soon as a #WM_LBUTTONDOWN message is generated.
I may look like a mule, but I'm not a complete ass.
- Thorsten1867
- Addict

- Posts: 1372
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
I must differentiate between selecting and doubleclick.srod wrote:However, I can add this if you wish, even though it would be useless for detecting a cell select because this is notified as soon as a #WM_LBUTTONDOWN message is generated.
I get no Event ( 'EventGadget()' ) if click on an cell/row, like 'ListIconGadget()'. Have you an idea, how I can an doubleclick event (for protected cells)?
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
I don't think you'll be able to do this, unless you forbid certain cells from being selected.Thorsten1867 wrote:I must differentiate between selecting and doubleclick.
I receive a #WM_LBUTTONDBLCLK event okay in a PB event loop!!!I get no Event ( 'EventGadget()' ) if click on an cell/row, like 'ListIconGadget()'. Have you an idea, how I can an doubleclick event (for protected cells)?
**EDIT:
Ah, if you wish to determine which cell is double-clicked then I can add that. It will require an extra CellCallback message. Such a double click will have no bearing on whether the cell is selected however; that's down to #WM_LBUTTONDOWN and your treatment of the #egrid_SelectCell CellCallback message.
Perhaps you should pm me some code?
I may look like a mule, but I'm not a complete ass.
Hi Srod, the download link from http://www.purecoder.net/download.htm
is broken (http://www.purecoder.net/egrid4setup.exe)[/b]
is broken (http://www.purecoder.net/egrid4setup.exe)[/b]
PB 6.21 beta, PureVision User
Hi Srod, the download link from http://www.purecoder.net/download.htm
is broken (http://www.purecoder.net/egrid4setup.exe)
is broken (http://www.purecoder.net/egrid4setup.exe)
Last edited by zikitrake on Tue Nov 14, 2006 7:13 pm, edited 1 time in total.
PB 6.21 beta, PureVision User
Not broken as such!zikitrake wrote:Hi Srod, the download link from http://www.purecoder.net/download.htm
is broken (http://www.purecoder.net/egrid4setup.exe)
Please see my above post dated the 12th November.
The library should be uploaded anew later tonight.
I may look like a mule, but I'm not a complete ass.

