|
-
Sep 6th, 2006, 05:57 AM
#1
Controls in a msflexgrid
As msflexgrids are not so flexible as the name suggests, I'm using a textbox for data input, so that after hitting return or any other key the proper action is taken (most of the time the textbox must be moved to fit into a neighbouring cell). The inputbox has a light blue background so as to simulate highlighting of the cell it is over.
Also in one of the flexgrid rows is an array of comboboxes, in another row an array of checkboxes and finally, a row has an array of (2 per cell) radio buttons. So if the textbox is in the cell just one above one of these and the down arrow key is hit, it must be made invisible and the control that receives the focus must be highlighted. When this control loses the focus, its backcolor must be set back to default. However, in the case of radio buttons, the control width is so small (to allow 2 of them to fit into the cell) that all that can be done is highlighting the cell itself.
I want to be able to run over all the cells and controls using just the keyboard, but allowing mouse clicks of course.
The whole thing is rather messy and for every problem I fix a new one appears, it's like continuously patching an old garment.
My question is: has anyone worked on something similar? Is there any "general" solution to this scenario? What approach would you guys advise? What I need is the general outlines.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Sep 6th, 2006, 08:41 AM
#2
Re: Controls in a msflexgrid
You don't have to use Textbox for editing cells - link in my signature will "take" to a thread with multiple flexgrid tips and tricks.
Also, cell style usually goes by the column - not byt the row.
-
Sep 6th, 2006, 10:43 AM
#3
Re: Controls in a msflexgrid
 Originally Posted by RhinoBull
You don't have to use Textbox for editing cells - link in my signature will "take" to a thread with multiple flexgrid tips and tricks.
Also, cell style usually goes by the column - not byt the row.
Hi RB, interesting tips, indeed.
Now, the main reason I use a textbox is I want to have the possibility to select the text, as the textbox has the SelStart and SelLength properties. Can you do that somehow with the flexgrid alone? If I want to change a cell's contents I hate having to delete the characters one by one -to be sure I can use the mouse e.g. clear the cell by right clicking, but I want to be able to do it with the keyboard as well...
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Sep 6th, 2006, 10:46 AM
#4
Re: Controls in a msflexgrid
in another row an array of checkboxes and finally, a row has an array of (2 per cell) radio buttons.
Also, rather than using controls, you can easily simulate CheckBoxes and Option buttons using symbolic fonts.
VB Code:
Private Sub Form_Load()
With Me.MSFlexGrid1
.Cols = 3
.Rows = 20
.ColWidth(0) = 300
.ColWidth(1) = 1200
.ColWidth(2) = 400
.FillStyle = flexFillRepeat
.Row = 1
.Col = 2
.RowSel = .Rows - 1
.CellFontName = "Wingdings"
.CellFontSize = 16
.ColAlignment(2) = flexAlignCenterCenter
.Text = "q"
.FillStyle = flexFillSingle
.Row = 1
.Col = 1
End With
End Sub
Private Sub MSFlexGrid1_Click()
With MSFlexGrid1
If .MouseCol = 2 Then
If .TextMatrix(.Row, 2) = "q" Then
.TextMatrix(.Row, 2) = "þ"
Else
.TextMatrix(.Row, 2) = "q"
End If
End If
End With
End Sub
-
Sep 6th, 2006, 11:15 AM
#5
Re: Controls in a msflexgrid
I'm wondering if it's worth using this control rather than the msflexgrid.
Looks like there's a large amount of information to read before you can get going, so I'd like to hear from anyone who may have used it.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Sep 6th, 2006, 11:19 AM
#6
Re: Controls in a msflexgrid
 Originally Posted by brucevde
Also, rather than using controls, you can easily simulate CheckBoxes and Option buttons using symbolic fonts.
[/Highlight]
If I have 2 radio buttons in the same cell, how do I go about simulating the click events? Do I have to check the mouse coordinates in the flexgrid's MouseMove event? May be a bit cumbersome, unless you assure me it really isn't...
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Sep 9th, 2006, 09:48 AM
#7
Re: Controls in a msflexgrid
To be continued in this new thread.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|