egrid 4 grid gadget - (static PB library version.)

Developed or developing a new product in PureBasic? Tell the world about it.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

30th November 2006.

Release version 1.4 now available.

A bug with using PURELVSort has been fixed.

Also, a new command added: egrid_HasSelectedCellChanged()
The use of this command should be obvious.

This was added to assist a current user of egrid etc.

http://www.purecoder.net/egrid.htm

:)
I may look like a mule, but I'm not a complete ass.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

how can i autoresize the header?

Code: Select all

PureLVSORT_SetLastColumnAutoResize(#egrid, #True) 
doesn't work (Custom Header)

regards
thomas
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.
Image
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

I can confirm a 'problem' (not just with the custom header), but I am finding the same problems when using a basic listicon instead of an egrid.

Actually, I am not sure this is a problem. As soon as the last column is smaller than the header text, it stops resizing automatically. Now this seems reasonable and is definitely at the heart of the behaviour I am seeing with listicons and egrids.

Now with an egrid, because of the custom drawing involved with the header, the problem is made apparent a little earlier than with listicons. Nothing serious though.
If you're using vertical text in the header, then this problem will be exacerbated.

In short this is just one of those Windows things.

I've looked at the PureLV source code and can see nothing wrong at all. In fact it's pure class! :)
Last edited by srod on Fri Jan 12, 2007 2:08 am, edited 1 time in total.
I may look like a mule, but I'm not a complete ass.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Is there a other way to resize a column?
It looks bad without resize the column :cry:
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.
Image
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

You can use:

Code: Select all

SendMessage_(GadgetID(#egrid), #LVM_SETCOLUMNWIDTH, egrid_NumberOfColumns(1), #LVSCW_AUTOSIZE_USEHEADER)
but this gives identical results to PureLVSORT, confirming that there really is nothing wrong.

All we're seeing is the normal Windows behaviour when resizing the last column etc.

Unless of course you've found something else which I haven't yet come across?

One thing comes to mind, namely there could be a problem with resizing the last column if you allow the user to reorder the columns by dragging etc. If this happens you may not be able to identify the column index of the last column etc.
I don't know if PureLVSORT takes account of this? Egrid does in that it will identify the index of the last column if you ask it to.

So, before using the above SendMessage_(), you should take steps to identify which column is actually last. For this, use the egrid_GetColumnOrderArray() function.
I may look like a mule, but I'm not a complete ass.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

with sendmessage it works :D
thank you
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.
Image
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Glad it works.

Thanks to the testing with the resizing columns, I've found a slight redrawing bug when a non-themed application is created so I'll have to try and fix this.

Expect an update soon.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

12th January 2007.

Release version 1.5 now available (minor bug-fix update).

When creating non xp-themed applications, there would be a 'stray' row of pixels between the header and the first row of the grid which wasn't being erased correctly.

Fixed.

Have also updated the manual to include the resizing 'tip' above.

http://www.purecoder.net/egrid.htm

:)
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

12th January 2007.

My apologies to those who have already downloaded the new version as I discovered another bug (related to the above one).

It's now fixed for version 1.5.1 and ready to download.

http://www.purecoder.net/egrid.htm
I may look like a mule, but I'm not a complete ass.
Q*bert
User
User
Posts: 27
Joined: Sat Dec 30, 2006 12:17 am
Location: Milwaukee, WI USA

Post by Q*bert »

eGrid is wonderfully flexible.

Is there a way to highlight the selected row rather than the selected cell?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Thanks. I'm glad you like it.

If by highlight the selected row you mean colour it, then the following shows one way.

Code: Select all

Procedure.l MyCellCallBack(egrid, uMsg, *cellinfo.egridCellInfo)
  Protected result
  Select uMsg
    Case #egrid_SelectCell
      ;Here we arrange for the selected row to be coloured.
      ;This requires a complete redraw of the egrid.
      ;The actual colouring has to be notified in the #egrid_FormatCell message below.
      result=#True
      RedrawWindow_(GadgetID(1), 0, 0, #RDW_INTERNALPAINT|#RDW_ERASE|#RDW_INVALIDATE)
    Case #egrid_LosingFocus
      ;As part of colouring the selected row, we must arrange to clear these
      ;colours whenever the selection box is removed.
      ;The actual colouring has to be notified in the #egrid_FormatCell message below.
      result=#True
      RedrawWindow_(GadgetID(1), 0, 0, #RDW_INTERNALPAINT|#RDW_ERASE|#RDW_INVALIDATE)
    Case #egrid_FormatCell
        If *cellinfo\row<>-1 And *cellinfo\row=egrid_SelectedRow(1)
          *cellinfo\backcolour = $A5F4F9
        EndIf
    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,"egrid - colour selected row.",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_Maximize|#PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
  ;******************************************************************************************
  
  ;********************************************EGRID*****************************************
  ;Create an egrid with resizable columns.
  egrid_CreateGrid(1, WindowWidth(0)/4, WindowHeight(0)/8, WindowWidth(0)/2, WindowHeight(0)/2,26,0, #egrid_ResizeColumnsTrue|#egrid_MultiLineText)
  ;******************************************************************************************
  egrid_CreateCellCallback(1, @MyCellCallBack())
  egrid_SetHeaderHeight(1, 26)
  egrid_SetOptions(1, -1, #Black, 2, -1) ; gadgetnum, header border colour, selection border colour, selection border width, gridline colour

  ;***************************************ADD COLUMNS AND ROWS TO EGRID**********************************
  egrid_AddColumn(1,0,"",60)
  For b=1 To 4 ;50 columns. 
    egrid_AddColumn(1,b,"Col " + Str(b-1),60)
  Next
  For b=0 To 99            ; Add 100 rows.
    egrid_AddRow(1,-1)
  Next
  
  ;*****************************************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.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

How can i get a checkboxclick (TRUE/FALSE), without selecting bei user?
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.
Image
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Sorry, I'm not sure I understand?

Do you wish to set the checkmark from code?
I may look like a mule, but I'm not a complete ass.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

No, i will capture the event to actualisizing information. I can found an
callback event that give me the information, that a checkbox has changed.
checkbox can be changed without selection
Last edited by ts-soft on Wed Jan 17, 2007 9:57 pm, edited 1 time in total.
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.
Image
merihevonen
Enthusiast
Enthusiast
Posts: 326
Joined: Mon Jan 01, 2007 7:20 pm

Post by merihevonen »

Yes that's what he means.
"How can you set a CheckBox mark programmatically"

This is really a wonderful project btw.
Post Reply