Page 2 of 25

Posted: Tue Sep 19, 2006 10:44 pm
by srod
egrid 4 beta 1, update 1. - 19th September 2006.

See the 'history.txt' file for a complete list of changes, but, in a nutshell:
  • have reduced flicker with the custom headers with some custom erasing and poking around with xp themes.
  • introduced flags #egrid_StandardHeader and #egrid_CustomHeader to make things less cryptic.
  • the 'egrid_CreateGrid()' command has been simplified by combining parameters into combinations of flags etc.
  • replaced the #egrid_PBImage cell type with #egrid_Bitmap in which you now supply bitmap handles rather than Purebasic image#s etc.
  • added a new cell type; #egrid_Icon. Icons can be sized on the fly.
Please visit my website (in my signature below) for the download.

For those new to PB, to install the library, simply place the 'Egrid4' file within your C:\Program files\Purebasic\PureLibraries\UserLibraries folder and the resident file 'egrid_Resident.res' within your C:\Program files\Purebasic\Residents folder. You will then need to restart Purebasic etc.

Right, now to start on the .chm help manual. Shouldn't take more than a year or so! :)

Posted: Tue Sep 19, 2006 11:03 pm
by rw
Hi srod!

Realy great work.

I try egrid with one of my projekts.

Any idea, how i can change the handling of the grid cursor if
the #PB_ListIcon_HeaderDragDrop flag is active and the order of the
colums has been changed?

Keep up the good work!

rw

Posted: Tue Sep 19, 2006 11:11 pm
by srod
Hi,

bugger me I forgot about drag-n-drop!

I'll need to adjust the library (5 mins work!) so that you can use drag-n-drop of columns. The problem is that the selection box will need removing else you'll get into a right old pickle! :)

As for the cursor, I'm not sure what you mean? The cursor doesn't normally change when dragging columns!

I will post an update in a few minutes.

Thanks.

**EDIT: I see what you mean now.

Unfortunately, I can find no notification which informs when a column drag is in process! I'll keep searching...

Posted: Wed Sep 20, 2006 12:24 am
by srod
Okay, it's fixed. The selection box is removed whenever a column drag is in operation.

However, you'll quickly see that unless you take charge of the drop completely, when the columns are reordered the indexes are not moved. This means that when you tab from column to column, the selection box will appear to jump all over the place!

For example, imagine columns 0 1 2 3 4 5 ... etc.

Drag column 2 to column 5 to get the order 0 1 3 4 2 5.

Now when you tab between cells, you will do so in the order 0 1 3 4 2 5 which is a fat lot of good! :)

Indeed have a look at the following code (nothing to do with egrid 4) and drag column 2 to column 1. You'll see that the output doesn't change.

Code: Select all

If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   If CreateGadgetList(WindowID(0))
     ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_HeaderDragDrop)
     AddGadgetColumn(0, 1, "Address", 250)
     AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
     AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
     Repeat
       Event = WaitWindowEvent()
Debug GetGadgetItemText(0,0,1)
     Until Event = #PB_Event_CloseWindow
   EndIf
 EndIf
I don't think there's much I can do about this as it is the way list view controls operate and it makes sense when you think about it, at least from Windows' point of view. After all, you'd lose track of where your data is otherwise. This way, the user can shift the columns around at will, and yet the programmer can still guarantee that the original indexes correspond to the original data etc.

From an egrid 4 point of view, not much we can do about it I'm afraid. In fact the windows messages (#HDN_ENDDRAG) doesn't even tell us where the column being dragged was actually dumped!

Getting around this would be a little fiddly and is probably not worth the effort to be honest.

Posted: Wed Sep 20, 2006 6:26 am
by rw
Hi!

I think you must take care of the "intern column index".

With the normal listicon control i use the following procedure

Code: Select all

#LVM_GETCOLUMNORDERARRAY = #LVM_FIRST + 59
#LVM_SETCOLUMNORDERARRAY = #LVM_FIRST + 58

Procedure.l GET_INTERN_SPALTEN_INDEX(lhandle.l, lvspalte_real.l)
Protected totalcolumns.l
totalcolumns = egrid_NumberOfColumns(lhandle);PureLVSORT_CountColumns(lhandle)
Protected Dim ColumnOrder.l(totalcolumns)

; Fülle Feld mit interner Spaltenreihenfolge

SendMessage_(GadgetID(lhandle),#LVM_GETCOLUMNORDERARRAY, totalColumns, @ColumnOrder(0))

If lvspalte_real > totalcolumns - 1

  ProcedureReturn -1
Else
  ProcedureReturn ColumnOrder(lvspalte_real)
EndIf

EndProcedure

I tried it with your egrid but no success. Can you take a look?

rw

Posted: Wed Sep 20, 2006 10:44 am
by srod
I see.

You're talking about a major rewrite of certain parts of the library to accomodate this. The #LVM_SETCOLUMNORDERARRAY does not seem appropriate since it is set by the column drag process anyhow.

However, I'd need to keep an eye on #LVM_GETCOLUMNORDERARRAY when allowing the user to tab between columns etc.

Have I got this right?

It is possible for you to do this with a CellCallback function. However, I agree that it would be better confined to the library internals. The only thing is that applications that do not require column dragging etc. will be slowed down a little whilst the library continually searches the column order array etc. Although I can easily flag whether the column orders have altered or not.

Uhm. I'll think about this rw. If I can convince myself that it's a worthwhile ammendement, then, by gum, I'll do it!

Must admit that I expected the drag to break the rendering of the grid, and was surprised when it didn't, even with the custom headers! :)

Posted: Wed Sep 20, 2006 6:29 pm
by rw
Hi srod!


Do it!!!!!!!!!!!!, please :-).

I have tested many grid controls and your´s is the best so far. And, Pure
Basic user or not, a donation is ready.

My procedure don´t function with egrid, did you something spezial in your code?

One question: Which cellcallback-message i must take do get the cursor movement?

One issue: If a cell is selected, and you resize the marked cell-column,
the selection is not updated properly.

Bye

rw

Posted: Wed Sep 20, 2006 9:09 pm
by srod
rw wrote:Do it!!!!!!!!!!!!, please :-).
I'm about to start... :)
I have tested many grid controls and your´s is the best so far. And, Pure
Basic user or not, a donation is ready.
Thanks.
My procedure don´t function with egrid, did you something spezial in your code?
Nothing that should stop you getting the column order array.
One question: Which cellcallback-message i must take do get the cursor movement?
You mean mouse movement? If your talking about cell navigation then you want #egrid_SelectCell.
If you want to track mouse movement then you simply use #WM_MOUSEMOVE as per usual in your Purebasic event loop (not the CellCallback).
One issue: If a cell is selected, and you resize the marked cell-column,
the selection is not updated properly.
Works okay here. With the combo box cells I temporarily remove the combo box whilst resizing. All other cells should stay put!

Cen you give me some more details. E.g. gridlines? xp themes? Any flags set etc.

In fact, pm'ing me the offending code would be the best bet!

**EDIT: yes, your procedure will not work because even though egrid 4 indexes columns from 0 to egrid_NumberOfColumns()-1; these actually correspond to the underlying ListIcon's columns 1 through egrid_NumberOfColumns(). The list icon used as a basic for an egrid has it's zero column blanked out (for various reasons).

Posted: Thu Sep 21, 2006 6:05 am
by rw
Hi srod!

About the issue.

Take your egrid demo1.

Select a cell (No input!) and resize column.

The cell selction (the black boarder) ist not resized if you make the
column smaller. If you make the column bigger, there is a little bit
garbage in the cell. if you move the cursor, the update is ok.

My system:

Athlon3500, WindowsXP, PureBasic4.0, XP-Themes on

Posted: Thu Sep 21, 2006 9:20 am
by srod
I cannot reproduce that here! It resizes fine. :?

The fact is that the selection box is a fake when you resize a column. The real selection box is hidden because it is a container gadget.

When a column is being resized, I physically draw a border to make it look like there is still a selection box and it of course matches the size of the selected cell, even whilst its being resized.

It sounds like, that for some reason, the real selection box is not being removed in your case.

You're not using a cellcallback with demo 1 are you?

**EDIT: try as I might I cannot persuade demo 1 to misbehave! I'm resizing columns, throwing them around, threatening them with violence... nothing! :? Uhm, this is strange.

I'm aware of a bug with painting the custom headers, but I'll get on to that later on.

Anything else you can tell me about the problem? Are you using gridlines?

Posted: Thu Sep 21, 2006 10:46 pm
by QuimV
Hello,
I'm sorry but the link to download "Egrid 4 - beta 1" in your site give me an error 404 "File not found"
http://www.rodriguz.freeserve.co.uk/egrid4.zip
Could you fix it?
Thanks a lot.
QuimV

:)

Posted: Thu Sep 21, 2006 10:49 pm
by srod
Yes it's down whilst I make some alterations. Some to do with rw's request to enable column drag and others to fix a few gdi bugs with the header.

As of now the bugs are fixed and I'm just working on the improvements.

Should be ready sometime tomorrow.

:)

Posted: Thu Sep 21, 2006 10:52 pm
by QuimV
:D
Thanks srod.
QuimV

Posted: Sun Sep 24, 2006 7:18 pm
by Thorsten1867
I've tried to download it:
The requested URL /egrid4.zip was not found on this server.

Posted: Sun Sep 24, 2006 7:31 pm
by srod
Read 4 posts back!

Egrid 4 beta 2 is (was!) complete.

However, am having a few problems persuading it to behave properly on Win 98!

Need to speed the painting process up a little before it will run properly on W98.

:)