Page 18 of 25

Posted: Wed Nov 08, 2006 11:19 am
by srod
Tailbite seems to rename it for some reason and I keep forgetting to change the name!

I'll do something about it! :)

Posted: Wed Nov 08, 2006 4:34 pm
by ts-soft
Rename egrid_Resident.pbi to egrid_Resident.pb :wink:

Posted: Wed Nov 08, 2006 4:49 pm
by srod
Will do! :)

Posted: Fri Nov 10, 2006 4:13 pm
by srod
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

Posted: Fri Nov 10, 2006 4:30 pm
by ts-soft
After deleting egrid_Resident.res it works fine :wink:

Posted: Fri Nov 10, 2006 4:32 pm
by srod
:oops:

Didn't think of that!

Better delete the old resident file before installing folks!

Thanks ts-soft.

Posted: Fri Nov 10, 2006 5:29 pm
by srod
My apologies, but demo 7 has a bug in it. (See release version 1.2)

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

Posted: Sun Nov 12, 2006 1:18 pm
by srod
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.

Posted: Sun Nov 12, 2006 1:42 pm
by Thorsten1867
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 :wink:

Posted: Sun Nov 12, 2006 8:56 pm
by srod
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.

Posted: Sun Nov 12, 2006 9:13 pm
by Thorsten1867
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 must differentiate between selecting and doubleclick.
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)?

Posted: Sun Nov 12, 2006 9:34 pm
by srod
Thorsten1867 wrote:I must differentiate between selecting and doubleclick.
I don't think you'll be able to do this, unless you forbid certain cells from being selected.
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)?
I receive a #WM_LBUTTONDBLCLK event okay in a PB event loop!!!


**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?

Posted: Tue Nov 14, 2006 7:10 pm
by zikitrake

Posted: Tue Nov 14, 2006 7:10 pm
by zikitrake

Posted: Tue Nov 14, 2006 7:12 pm
by srod
zikitrake wrote:Hi Srod, the download link from http://www.purecoder.net/download.htm
is broken (http://www.purecoder.net/egrid4setup.exe)
Not broken as such!

Please see my above post dated the 12th November.

The library should be uploaded anew later tonight. 8)