Results 1 to 10 of 10

Thread: Logic problem in a flexgrid [appeal for gurus!]

  1. #1

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Logic problem in a flexgrid [appeal for gurus!]

    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.
    Attached Files Attached Files
    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)

  2. #2
    Addicted Member senthilkumartd's Avatar
    Join Date
    Feb 2005
    Posts
    206

    Re: Logic problem in a flexgrid

    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
    Last edited by senthilkumartd; Sep 9th, 2006 at 11:00 AM.

  3. #3

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Logic problem in a flexgrid

    Quote Originally Posted by senthilkumartd
    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)

  4. #4

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Logic problem in a flexgrid

    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)

  5. #5

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Logic problem in a flexgrid

    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.
    Attached Files Attached Files
    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)

  6. #6

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Logic problem in a flexgrid

    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)

  7. #7

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    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)

  8. #8
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    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.

    The project is attached.
    Attached Files Attached Files
    Last edited by jcis; Sep 14th, 2006 at 11:52 PM.

  9. #9

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Logic problem in a flexgrid [appeal for gurus!]

    Quote 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)

  10. #10

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width