I have made a little demo project to show more clearly what I asked in this thread -still unanswered.
The msflexgrid uses a textbox for text editing because I wanted to have the selstart and sellength properties available, which the flexgrid cells don't have, It's working fine, but now I want to add a further refinement: if any cell from a specific row, say row 10, is clicked on, or if the textbox is in the previous row (9) and you hit return or arrow down (or if we are in row 11 and we hit arrow up, etc) I want a checkbox to appear in that cell instead of the textbox. When the user has chosen the checkbox state (by means of the spacebar key or the mouse) and hits return (or clicks another cell with the mouse), I want the checkbox to be made invisible and the textbox to appear in the corresponding cell.
Doesn't seem to be too complicated, but the logic of it is driving me bananas.
Last edited by krtxmrtz; Sep 12th, 2006 at 09:35 AM.
Reason: Badly need help
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)
First of all I am exciting with your perfect coding. Nice.
Now try this,
I).In the SetupTextBox() procedure,
1. Display the CheckBox
2. Make visible=false for textbox
Note: Use Boolean type array to store the status of the each cell (Checked or Unchecked)
II). In the click event of the Check Box,
1. Store the checked value into the Boolean Array
2. Now display the TextBox
Well. How about the bookkeeping, i.e. where must the checkbox be placed (depending on the column we are in), where do we place the textbox, do we have to place it (invisible) in the same cell as the textbox or not, etc.
The problem is I've been trying all sorts of things, very similar -more or less- to what you suggest, and what I need is the exact list of all issues I have to take into account, in what order and all the bookkeeping.
Not that I'm so lazy that I want someone else to do the job for me (actually, yes, I'd love that ), it's just that I'm lost in a maze and do really need actual working code.
I have seen similar flexgrids with these features implemented in thirdt party applications, so i guess there must be some sort of "general recipe".
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)
I have updated the demo project to include scrolling. There's a problem with right scrolling (when the scrollbar's left arrow is clicked) but not when you click directly on the scrollbar itself.
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)
Attached is a new version where scrolling seems to be fixed and working.
I still don't know how to solve the logic to include a checkbox.
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)
Would any caritative soul try out the demo project grid2.zip and see if something can be done with that checkbox?
Last edited by krtxmrtz; Sep 12th, 2006 at 09:32 AM.
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)
Re: Logic problem in a flexgrid [appeal for gurus!]
bump
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)
Re: Logic problem in a flexgrid [appeal for gurus!]
This is another way of doing it, using symbols (Windings font) instead of real checkboxes.
To know if a cell is checked or not, you need to know this:
þ (ALT-231) is the checked symbol
q is the unchecked symbol
So, if Grid.Textmatrix(i,j) = "þ" then its checked, else it's not.
You can change the Checkbox Row / Font size / Color for the checked/unchecked symbol if you want, using the constants defined on top of the Form:
mCnstCheckBoxRow
mCnstCheckBoxColor
mCnstCheckBoxSize
To check / uncheck these checkboxes just click them or use Spacebar.
Re: Logic problem in a flexgrid [appeal for gurus!]
Originally Posted by jcis
This is another way of doing it, using symbols (Windings font) instead of real checkboxes.
To know if a cell is checked or not, you need to know this:
þ (ALT-231) is the checked symbol
q is the unchecked symbol
So, if Grid.Textmatrix(i,j) = "þ" then its checked, else it's not.
You can change the Checkbox Row / Font size / Color for the checked/unchecked symbol if you want, using the constants defined on top of the Form:
mCnstCheckBoxRow
mCnstCheckBoxColor
mCnstCheckBoxSize
To check / uncheck these checkboxes just click them or use Spacebar.
The project is attached.
This is quite interesting, but the thing is I don't want the checkboxes to be shown on the cells, except on that specific cell I'm editing.
At any rate, this checkbox thing is just a test whereby I'm trying to learn the general procedure to have any similar control working on the grid (i.e. like a well-olied machine) and once this has been accomplished I want to use comboboxes and radio buttons as well, all with the same behaviour as the checkbox.
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)
Re: Logic problem in a flexgrid [appeal for gurus!]
This sort of grid with various different controls activating when you reach some cell is something I've seen in third party applications, so I know it must not be that difficult to implement. Once I have a project working I will keep a minimum template for future use.
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)