Page 1 of 1

fix memo-table-cell-border-lines

Posted: Sat May 06, 2006 11:13 am
by j&b
Hello Sergey,

I have written to you for a few days about a possibility to fix memo-table-cell-border-lines, so that user can't resize them ?
Background: If I work quick I often have changed col.width if I mark something in a cell.

My solutions doesn't work, if I click direct on a cell-border-line. If I click 1 (or 2 pixel) beneath cell-border-line all ok.

What can I do that memo-table-cell-border-lines can't be resized ?

Best regards,

Jürgen


procedure TForm1.memoRVMouseDown(Sender: TCustomRichView; Button: TMouseButton; Shift: TShiftState; ItemNo, X, Y: Integer);
begin
if memo.GetCurrentItemEx(TRVTableItemInfo, rve, TCustomRVItemInfo(rveTable)) then begin
//ColRowResize is a menuItem where I allow user to change (or not to change) resizing
if ColRowResize.checked=true then rveTable.Options:=
rveTable.Options-[rvtoRowSizing,rvtoColSizing]
else rveTable.Options:=rveTable.Options+[rvtoRowSizing,rvtoColSizing];
end;
end;

Posted: Sat May 06, 2006 2:21 pm
by j&b
Hello Sergey,

I have looked in your rvTable.pas.

There I have found
const
RVTABLEDEFAULTOPTIONS = [rvtoEditing, rvtoRowSizing, rvtoColSizing, rvtoRowSelect, rvtoColSelect];

If I delete rvtoRowSizing and rvtoColSizing all runs as I want it.

But I want manage it about a menuItem.

How can I use RVTABLEDEFAULTOPTIONS sometimes with rvtoRowSizing and rvtoColSizing and sometimes without rvtoRowSizing and rvtoColSizing (in my first mail I noticed a problem by using rveTable.Options:=rveTable.Options-[rvtoRowSizing,rvtoColSizing]).

Jürgen

Posted: Sat May 06, 2006 5:01 pm
by Sergey Tkachenko
It's not a good idea to modify source code.
Why not to put your code not in OnRVMouseDown, but in ColRowResize.OnClick?

Unfortunately, assignment to table.Options cannot be undone. But at least you can set the document state as "modified" by calling memo.Change.

Posted: Sun May 07, 2006 10:04 am
by j&b
Hello Sergey,
thanks for your information.

I think as you (It's not a good idea to modify source code).

I have tried many times to solve my problem and I think that the best way is to set RVTABLEDEFAULTOPTIONS without rvtoRowSizing, rvtoColSizing because user can't destroy a good built table by unconcentrated working. If user want to resize col (or row) he must do it fully aware of importance.

Can you think about the problem a) of resizing col/row by unconcentrated working and b) about the matter of resizing cols/rows (isn't it a aware of importance ?).

If you think so too, isn't it better to set RVTABLEDEFAULTOPTIONS without rvtoRowSizing, rvtoColSizing (in rvTABLE.PAS) and to work with a menuItem (or button) to change TRVTableItemInfo.options ?

The background for my question ist that I don't want to change your code because I have to change RVTABLEDEFAULTOPTIONS with every rvTable.pas-update (and I hope that I don't forget it).


Jürgen


{
procedure TForm1.ColRowResizeClick(Sender: TObject);
begin //ColRowResize.caption:='Zeilen/Spalten NICHT per Maus vergößern können';
if (memo.CanChange) and (memo.GetCurrentItemEx(TRVTableItemInfo, rve,
TCustomRVItemInfo(rveTable))) then begin
if rvtoColSizing in rveTable.Options then begin
ColRowResize.checked:=true;
rveTable.Options:=rveTable.Options-[rvtoRowSizing,rvtoColSizing];
end else begin
ColRowResize.checked:=false;
rveTable.Options:=rveTable.Options+[rvtoRowSizing,rvtoColSizing];
end;
memo.change;
end;
}

Posted: Sun May 07, 2006 11:50 am
by aoven
because user can't destroy a good built table by unconcentrated working. If user want to resize col (or row) he must do it fully aware of importance.
Well, that's why the "undo" command is there for! :)

Posted: Mon May 15, 2006 3:05 pm
by Sergey Tkachenko
You can modify table.Options when you insert a new table.
If you want to do it not only for tables created in your application, but also for tables inserted with RTF/RVF files, use OnItemAction event (when ItemAction=rviaInserted)
There is no need to change the constant.