Board index » cppbuilder » OOPS: Re: Selecting (ranges of) Cells and Editing Cells doesn't work quite right

OOPS: Re: Selecting (ranges of) Cells and Editing Cells doesn't work quite right

Ted I took a quick look at your code and wondered if this was a mistake in
the code or in the transcription:

  if ( (!weAreEditing ) &&
    // make sure we have selected only one cell
    (ReferenceGrid->Selection.Right == ReferenceGrid->Selection.Left) &&
    (ReferenceGrid->Selection.Bottom == ReferenceGrid->Selection.Top) ) {
    weAreEditing = true;
    ReferenceGrid->Options = ReferenceGrid->Options << goEditing;
  }; <- this semi colon.

you have the same thing in your grid select method

(you didn't post a follow up on using so I answered here)

--
CheGueVerra
Team Revolution

Quote
Ted Byers <ted.by...@sympatico.ca> wrote in message

news:3c7db545$1_2@dnews...
Quote
> OOPS: sorry, this belongs in vcl.components.using, but I didn't notice I
was
> in the wrong newsgroup when I created it.

> Sorry,

> Ted

 

Re:OOPS: Re: Selecting (ranges of) Cells and Editing Cells doesn't work quite right


Quote
"Chegueverra" <bdi...@noomnivoxspam.com> wrote in message

news:3c7e54d1_2@dnews...
Hi.

Thanks.

Quote
> Ted I took a quick look at your code and wondered if this was a mistake in
> the code or in the transcription:

It must be transcription of the message.

Quote
>   if ( (!weAreEditing ) &&
>     // make sure we have selected only one cell
>     (ReferenceGrid->Selection.Right == ReferenceGrid->Selection.Left) &&
>     (ReferenceGrid->Selection.Bottom == ReferenceGrid->Selection.Top) ) {
>     weAreEditing = true;
>     ReferenceGrid->Options = ReferenceGrid->Options << goEditing;
>   }; <- this semi colon.

> you have the same thing in your grid select method

Thanks, but ...

Nope.  I don't.  I just copied the following from the end of my first post
on this topic..

void __fastcall TForm1::ReferenceGridSelectCell(TObject *Sender, int ACol,
      int ARow, bool &CanSelect)
{
  if (weAreEditing) {
    ReferenceGrid->Options = ReferenceGrid->Options >> goEditing;
    weAreEditing = false;
  };

Quote
}

//--------------------------------------------------------------------------

Thanks,

Ted

Re:OOPS: Re: Selecting (ranges of) Cells and Editing Cells doesn't work quite right


I've been playing around with your code  .. and I tried this ...
[original]
void __fastcall TForm1::ReferenceGridSelectCell(TObject *Sender, int ACol,
      int ARow, bool &CanSelect)
{
  if (weAreEditing) {
    ReferenceGrid->Options = ReferenceGrid->Options >> goEditing;
    weAreEditing = false;
  };

Quote
}

[test]
void __fastcall TForm1::ReferenceGridSelectCell(TObject *Sender, int ACol,
      int ARow, bool &CanSelect)
{
  if (weAreEditing) {
        weAreEditing = false;
  };

Quote
}

Is this the behavior you wanted ??

--
CheGueVerra
Team Revolution

Re:OOPS: Re: Selecting (ranges of) Cells and Editing Cells doesn't work quite right


Quote
"Chegueverra" <bdi...@noomnivoxspam.com> wrote in message

news:3c7e76a9_1@dnews...

Quote
> I've been playing around with your code  .. and I tried this ...
> [original]
>   if (weAreEditing) {
>     ReferenceGrid->Options = ReferenceGrid->Options >> goEditing;
>     weAreEditing = false;
>   };
> }

> [test]
>   if (weAreEditing) {
>         weAreEditing = false;
>   };
> Is this the behavior you wanted ??

No.  First, because I can not subsequently select a range.  Second, because
I see the text that is already in the cell disappear (except for text that
is selected).

The default options, but with goEditing set to true, are acceptabe except
that I can not select a range of cells.

I have, with those settings, oh yes, and with show editor always set to
true, been able to select a cell, and use the mouse to position the cursor
within the text within the cell.  As I indicated, the only thing wrong with
that configuration is that I can not select a range of cells.

According to the documentation, goRangeSelect is ignored if goEditing is
true, so it looks like I need a means of toggling goEditing on and off: but
in what event handlers (since the two I am using aren't working).

Thanks,

Ted

Re:OOPS: Re: Selecting (ranges of) Cells and Editing Cells doesn't work quite right


Ted,

    Maybe you need to reset the RansgeSelect option.  Once you have enabled
the goEditing to the options of the TStringGrid the goRangeSelect gets
turned off, but when you turn off the goEditing the goRangeSelect doesn't
come back to it's initial setting, maybe by reassigning it to the Option
will permit you to peform Range Selections

CheGueVerra
Team Revolution

Other Threads