Solved

Another Flexgrid Question

Posted on 1998-12-12
5
517 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

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

Expert Comment

by:traygreen
ID: 1449703
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
ID: 1449704
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
ID: 1449705
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
ID: 1449706
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
using Access 8 83
VBA/SQL - Connect to SQL server and pull data 4 134
VBA filters 2 70
Access query that references subform 5 48
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

761 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