Solved

Another Flexgrid Question

Posted on 1998-12-12
5
509 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

932 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

13 Experts available now in Live!

Get 1:1 Help Now