Solved

Another Flexgrid Question

Posted on 1998-12-12
5
508 Views
Last Modified: 2012-06-21
How would I trap a click or mousedown event to the Header of a flex grid??? An example would be if I user clicks the Name header of the grid. I want the rows to be sorted in order of Name. Any ideas?? Code would be helpful
0
Comment
Question by:gcw
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
traygreen earned 50 total points
Comment Utility
The click event is the way to go...
0
 
LVL 3

Expert Comment

by:traygreen
Comment Utility
code as follows or set up however you want....


Private Sub grdTest_Click()
   Static SortOrder As SortSettings

   If grdTest.Row = 0 And grdTest.Col <> 0 Then
      If SortOrder = flexSortNone Or SortOrder = flexSortGenericDescending Then
         grdTest.Sort = flexSortGenericAscending
      Else
         grdTest.Sort = flexSortGenericDescending
   End If
End Sub
0
 

Author Comment

by:gcw
Comment Utility
I suppose there is a problem with the flexgrid settings. Everytime I click anywhere on the header, it always wants to select the first item in the list.  So flex1.row will always = 1. What are your default settings when you try your code. It doesn't seem to work on my end.. thanks!

GCW
0
 
LVL 3

Expert Comment

by:traygreen
Comment Utility
I have fixedrows set to 1...
Short of that nothing.  We use it all of the time.

other than that....

   Begin vsFlexLib.vsFlexArray grdQuery
      Height          =   1452
      Left            =   180
      TabIndex        =   16
      Top             =   1080
      Width           =   7092
      _Version        =   196608
      _ExtentX        =   12509
      _ExtentY        =   2561
      _StockProps     =   228
      Appearance      =   1
      ConvInfo        =   1418783674
      FormatString    =   $"OrderQ.frx":08CA
      Rows            =   2
      Cols            =   7
      FixedCols       =   0
      ScrollBars      =   2
      SelectionMode   =   1
      AllowBigSelection=   0   'False
      AllowSelection  =   0   'False
   End

This instance is using the vsflexgrid, but the code and parameter settings are the same for MSFlex.  If you still are having problems, email me the form @ traygreen@hotmail.com and I'll see what I can do.

0
 

Author Comment

by:gcw
Comment Utility
I mentioned this problem on a newsgroup.  I was told not to use the click event but the mousedown event and do a select case on .mousecol, which does what I want. I appreciate your help anyway. One of the settings you used (AllowSelection  =   0) does not show up as a valid property or method for the msflexgrid.. so there may be diferences.  Is the vsflexgrid control shareware?? I may want to try it to compare the two.

GCW
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now