Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSHFLEXGRID selecting an entire row on click

Status
Not open for further replies.

Overdoos

IS-IT--Management
May 31, 2000
79
0
0
BE
Hello,

I'm using an MSHFlexGrid to display data. This flexgrid is placed in a frame that is coupled to a tab-strip.

What I would like to do, but cannot seem to get it to work, is the following:
* when I select the tab where the flexgrid resides, I would like the first row of the flexgrid to display as being 'selected' (-> highlighted in blue)
* when a cell is clicked in the flexgrid, the entire row of that cell gets selected.

What have I done / What doesn't work?

Well, there is no problem displaying the flexgrid and fetching data in rows.
Where it goes wrong is with the 'selecting a row'. I cannot seem to highlight a row from a flexgrid. Anybody got an idea?
 
i am not sure what u r asking but

for selecting entire row goto FlexGrids property and Set the Selection Mode to : By Row.

HTH

Gazal
 
*urgl*

Thanks Gazal. I feel soooo stupid now :/ That was indeed what I needed to do.
 
oh, one more thing though...

I need to highlight the first row of the flexgrid when I select the tab (from the tabstrip) where the flexgrid is located.

Any idea how to do that?

Code:
  _________________________
 /____/____/ details \_____\____________________
| _____________________________________________ |
||___|_________|____________|____________|_____||
||_>_|_#######_|_##########_|_##########_|_###_||
||___|_________|____________|____________|_____||
||___|_________|____________|____________|_____||
||___|_________|____________|____________|_____||
|_______________________________________________|
 
Simply on the Tabl Click Even Write

MSFlexgrid1.Setfocus
HTH

Gazal
 
well, that is what i do, but it does not seem to work.

Another funny thing is that, whenever I click a cell of the flexgrid, the previous row gets highlighted...

I don't know, but it could be that these 2 strange behaviours are connected in some way.
 
hi overdoos

make sure that there is no code written on Flex Grids click event, and regarding set focus try this

msflexgrid1.col = 0

hth

gazal
 
Nothing in the click-event...

It keeps getting funnier though. The more I test stuff, the more I find the behaviour to get even weirder.

Are you ready? The col=0 doesn't help.
I can select the tab and everything shows up fine, but nothing is highlighted (the correct field is selected though).

The faulty behaviour continues until I get to a list that is bigger than the flexgrid so a scrollbar appears. Once I scroll down to the bottom and scroll up again, I can select what I need and after that... EVERYTHING works. (so even the highlighted row upon selecting the tab).

very strange
 
sorry to bump this one (I know it's not 'nice behaviour') but I would really like some more opinions on this....
 
gazal,

we were so close...

if you put this in the tab-click-event, the first line of the flexgrid will get highlighted.
Code:
msflexgrid1.setfocus
msflexgrid1.col = 0
msflexgrid1.colsel = msflexgrid1.cols - 1

For those that are not very well known with flexgrids (like myself), this might come inhandy...
Code:
The difference between row, rowsel, col, colsel:
 _______________________________________________
|__|_______|______|_______|_________|___________|
|__|_______|______|_______|_________|___________|
|__|_______|_####_|_#####_|_#######_|___________|-> row
|__|_______|_####_|_#####_|_#######_|___________|
|__|_______|_####_|_#####_|_#######_|___________|
|__|_______|_####_|_#####_|_#######_|___________|
|__|_______|_####_|_#####_|_#######_|___________|-> rowsel
|__|_______|______|_______|_________|___________|
|__|_______|______|_______|_________|___________|
               |                |
               '-> .col         '-> .colsel

1 last problem though...

When I click a row, it is always the line above the one I click that gets highlighted. Anybody got an idea?
 
hi

looks to be a code specific problem, coz i tried reporoducing the same error but cant get it...

Check your code, somewhere you must have written.

msflexgrid.row -1 or something like that...

HTH

Gazal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top