It is currently Fri May 24, 2013 8:42 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 332 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 23  Next
Author Message
 Post subject:
PostPosted: Sat Apr 14, 2007 6:52 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 238
Location: BARCELONA - SPAIN
Hi,

:o Why egrid generate massive "#egrid_UserResizeColumn" messages when I pass the mouse over the headers without attenting to resize any column?

I include comments from the egrid help file and sample code.

Thanks in advanced.

Code:
;******************************************************************************************
;'egrid5' editable grid control. By Stephen Rodriguez.
;******************************************************************************************

;                                 DEMONSTRATION PROGRAM 5.


;******************************************************************************************
;This demo program sets up a simple egrid and shows how to use a CellCallback function
;to reinstate the selection box after a column resize.
;The same method can be used to reinstate the selection box after a column drag or a resize column by the user..
;******************************************************************************************


;*****************************************FONT DATA****************************************
Enumeration
  #head1
  #head2
  #main
EndEnumeration
LoadFont(#main, "Arial", 9)
;SetGadgetFont(#PB_Default,FontID(#main))
;******************************************************************************************


Procedure.l MyCellCallBack(egrid, uMsg, *cellinfo.egridCellInfo)
  Protected result
  Static oldcol, oldrow

  Select uMsg
    Case #egrid_LosingFocus
      If *cellinfo\row<>-1
        oldcol=*cellinfo\column
        oldrow=*cellinfo\row
      EndIf
      egrid_SetCellSelection(1, -1, 0,0, 0) ;Remove the selection.

    Case #egrid_UserResizeColumn
      Debug "#egrid_UserResizeColumn"
      ; *** FROM HELP FILE ***
;     #egrid_UserResizeColumn
;     Signifies that the user is attempting To resize a column in an egrid (either by clicking-And-dragging Or by double-clicking the header etc.)
;     This message is only sent If the underlying egrid has the resizecolumns creation flag set To #egrid_ResizeColumnTrue.
;     
;     Returning #True allows the column To be resized.
;     Returning #False prohibits the column from being resized     



    Case #egrid_RegainFocus
      If *cellinfo\param=#egrid_ResizeColumn Or *cellinfo\param=#egrid_DragColumn
        egrid_SelectCell(1, oldcol, oldrow, 0)
;        egrid_SetCellSelection(1, oldcol,oldrow,1,1)
      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,"egrid4 demo 5.",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#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,28,#egrid_HeaderDragDrop|#egrid_GridLines, #egrid_ResizeColumnsTrue)

  ;******************************************************************************************
  egrid_CreateCellCallback(1, @MyCellCallBack())
  egrid_SetHeaderHeight(1, 26)
  egrid_SetOption(1, #egrid_HeaderBorderColour, #Red)
  egrid_SetOption(1, #egrid_SelectionBorderColour, #Blue)
  egrid_SetOption(1, #egrid_SelectionBorderWidth, 2)

  ;********************************************TEXT GADGET***********************************
 
  ;***************************************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
  egrid_AddRows(1,-1, 100) ;Add 100 rows.
  For b=0 To 99           
    egrid_SetCellText(1, 0,b, "Row "+Str(b))
  Next
 
  ;*****************************************EVENT LOOP***************************************
  Repeat
    EventID = WaitWindowEvent()
   
    Select EventID
     
      Case #PB_Event_Gadget
        Select EventGadget()
        EndSelect
    EndSelect
  Until EventID = #PB_Event_CloseWindow
 
EndIf
 
End

_________________
QuimV


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 14, 2007 7:25 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
QuimV wrote:
Hi,

:o Why egrid generate massive "#egrid_UserResizeColumn" messages when I pass the mouse over the headers without attenting to resize any column?


If you choose to create an egrid with the style flag #egrid_ResizeColumnsFalse then no #egrid_UserResizeColumn messages are sent at all.

On the other hand if you use the flag #egrid_ResizeColumnsTrue, then you can still prevent the columns being resized at runtime by responding to the #egrid_UserResizeColumn message. In this case, egrid needs to know if you are preventing the resize of a particular column whenever the mouse passes over the divider in order to prevent Windows from changing the cursor to the resizing one. Preventing the resize is one thing, stopping windows displaying the sizing cursor is another.

The message is required because egrid does not store any information on individual cells or columns etc. instead relying on the CellCallback function when provided.

I am toying with the idea of getting egrid to store information on cells and columns/rows etc. but this then makes setting up the initial egrid a little more cumbersome in my opinion.

I hope this answers your question. :)

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 15, 2007 12:31 am 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 238
Location: BARCELONA - SPAIN
Hi,

In my opinion this message shoud be sent only when the user is attempting to resize a column. I mean that will be true when the user clicks LeftButtonDown and then LeftButtonUp (dragging or double-clicking as you show in the help file, - the trigger will be the Mouse click).

I will try to do that using the LeftButtonDown and LeftButtonUp messages and a static flag inside my callback function.

Thanks a lot for your answer, srod.

_________________
QuimV


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 15, 2007 10:31 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
QuimV wrote:
Hi,

In my opinion this message shoud be sent only when the user is attempting to resize a column. I mean that will be true when the user clicks LeftButtonDown and then LeftButtonUp (dragging or double-clicking as you show in the help file, - the trigger will be the Mouse click).


But, as I explained, in the case that I do not send the #egrid_UserResizeColumn message at these times, Windows will automatically display the sizing cursor even when you've denied permission for an individual column from being resized.

I don't see what the problem is in firing multiple #egrid_UserResizeColumn messages, I mean all egrid is essentially doing is passing on the Windows message WM_SETCURSOR etc. which will be sent regardless of whether egrid converts them to #egrid_UserResizeColumn or not.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 15, 2007 5:32 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 19, 2007 5:47 pm
Posts: 130
Location: Luxemburg
Hello Srod,

Thank you for your answer. Of course I use egrid 5. I would be pleased to get an example, you can send it to the same address as the registration code yesterday.

Other question: Is there already a possibility to reduce the height of a cell in order to get a few more rows on a window?

Michel


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 15, 2007 6:06 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
Afraid that all rows have the same height in an egrid. You can change this height, but it affects all rows.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 15, 2007 6:24 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Aug 07, 2003 7:01 pm
Posts: 2853
Location: United Kingdom
When clicking a cell you get a message:

#egrid_LeftButtonDown

Releasing gives:

#egrid_LeftButtonUp

But if you click twice slightly faster (not a double click speed though), you get just one leftbuttondown and two leftbuttonups.

Is this correct, a bug or just my machine?

Otherwise GREAT! :D

_________________
http://www.SinisterSoft.com <- My Business website
http://www.ReportComplete.com and http://www.ReportPlus.co.uk <- School end of term reports system


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 15, 2007 6:38 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Apr 25, 2003 11:08 pm
Posts: 398
srod,

Most of your egrid5 example programs no longer work because they use the removed command egrid_AddRow().

Regards,
Eric


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 15, 2007 7:14 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
I have just checked all example programs in the install and they all use egrid_AddRows().

You must be combining the new libraries with the old examples somehow.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 15, 2007 7:22 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
DoubleDutch wrote:
When clicking a cell you get a message:

#egrid_LeftButtonDown

Releasing gives:

#egrid_LeftButtonUp

But if you click twice slightly faster (not a double click speed though), you get just one leftbuttondown and two leftbuttonups.

Is this correct, a bug or just my machine?

Otherwise GREAT! :D


Yes, this could be 'normal'. The reason I didn't add a double click message is because the first click brings up the edit control (if the cell is of string type) and the second will register with the edit control. What you are seeing could be part of this same process.

I wouldn't worry too much about it. :)

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 16, 2007 11:26 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
Update - egrid 5 version 1.02.

Have refined the cell selection process so that the selection automatically scrolls even when the cursor is not over the egrid (the previous version was slightly flawed in this respect).

Have rewritten the code responsible for creating borders etc. This has led to a vast improvement in the selection rectangle when selecting cells (in that it is no longer disjointed!) It looks a lot better now.

(Have uploaded an updated package with the static libraries, the dll version still requires updating which I'll do tonight.)

egrid forum: http://egrid.aceboard.com/
egrid website: http://www.purecoder.net/egrid.htm

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 16, 2007 2:24 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Apr 25, 2003 11:08 pm
Posts: 398
Quote:
You must be combining the new libraries with the old examples somehow.


srod,

You're absolutely right - sorry about the confusion.

Regards,
Eric


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 16, 2007 2:34 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
No worries.

:D

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 16, 2007 9:27 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
Update - egrid 5 version 1.03.

Bugfix!

Have also updated the dll version to bring it in line with the static library version etc.

egrid forum: http://egrid.aceboard.com/
egrid website: http://www.purecoder.net/egrid.htm

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 20, 2007 8:45 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 525
Location: Germany
srod wrote:
Have replaced the command egrid_AddRow() with egrid_AddRows().

HELP! What have you done? :wink:
I've to change over 20 'egrid_SetOption()' and 'egrid_AddRows()' in my program.

_________________
PS: Sorry for my bad English. My native language is German.

My PureBasic-Project: EasySetup - SetupMaker for your programs
[Windows 7 x64] [PB V5.0x]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 332 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 23  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye