Thread View: pl.comp.lang.tcl
6 messages
6 total messages
Started by jartymiak
Wed, 18 Jan 2006 13:41
dziwne zachowanie undo / entry
Author: jartymiak
Date: Wed, 18 Jan 2006 13:41
Date: Wed, 18 Jan 2006 13:41
15 lines
1547 bytes
1547 bytes
Witajcie, Mam problem z prostym skryptem Tcl/Tk. Zaimplementowałem w nim mechanizm obsługujący polecenia Edit->Copy, Edit->Paste, Edit->Undo. Po wykonaniu poleceń Edit->Copy, Edit->Paste, Edit->Undo w polu entry pojawia się nie tylko poprzednia zawartość, ale i dane położone wcześniej do schowka. Czy spotkaliście się z takim problemem? Nie jest to wina błędnego kopiowana danych lub ściągania danych ze schowka przez mój skrypt. System operacyjny: Windows XP Home PL Jacek
Re: dziwne zachowanie undo / entry
Author: Artur
Date: Wed, 18 Jan 2006 16:10
Date: Wed, 18 Jan 2006 16:10
52 lines
3404 bytes
3404 bytes
Tu prawdobodobnie chodzi o "separator" Z Dokumentacji widget text THE UNDO MECHANISM The text widget has an unlimited undo and redo mechanism (when the -undo widget option is true) which records every insert and delete action on a stack. Boundaries (called "separators") are inserted between edit actions. The purpose of these separators is to group inserts, deletes and replaces into one compound edit action. When undoing a change everything between two separators will be undone. The undone changes are then moved to the redo stack, so that an undone edit can be redone again. The redo stack is cleared whenever new edit actions are recorded on the undo stack. The undo and redo stacks can be cleared to keep their depth under control. Separators are inserted automatically when the -autoseparators widget option is true. You can insert separators programmatically as well. If a separator is already present at the top of the undo stack no other will be inserted. That means that two separators on the undo stack are always separated by at least one insert or delete action. The undo mechanism is also linked to the modified flag. This means that undoing or redoing changes can take a modified text widget back to the unmodified state or vice versa. The modified flag will be set automatically to the appropriate state. This automatic coupling does not work when the modified flag has been set by the user, until the flag has been reset again. See below for the edit widget command that controls the undo mechanism. Zobacz takze $window undo seperator i opcja -autoseparators > Witajcie, > > Mam problem z prostym skryptem Tcl/Tk. Zaimplementowałem w nim > mechanizm obsługujący polecenia Edit->Copy, Edit->Paste, Edit->Undo. > > Po wykonaniu poleceń Edit->Copy, Edit->Paste, Edit->Undo w polu entry > pojawia się nie tylko poprzednia zawartość, ale i dane położone > wcześniej do schowka. > > Czy spotkaliście się z takim problemem? Nie jest to wina błędnego > kopiowana danych lub ściągania danych ze schowka przez mój skrypt. > > System operacyjny: Windows XP Home PL > > Jacek
Re: dziwne zachowanie undo / entry
Author: jartymiak
Date: Wed, 18 Jan 2006 18:57
Date: Wed, 18 Jan 2006 18:57
2 lines
1263 bytes
1263 bytes
Tylko, ze widget entry nie ma tej opcji. Ale spróbuje z 1-linijkowym widgetem text zamiast entry.
Re: dziwne zachowanie undo / entry
Author: jartymiak
Date: Thu, 19 Jan 2006 00:09
Date: Thu, 19 Jan 2006 00:09
1 lines
1327 bytes
1327 bytes
Hmm. Tez nie dziala tak jak powinno...
Re: dziwne zachowanie undo / entry
Author: Artur
Date: Thu, 19 Jan 2006 07:39
Date: Thu, 19 Jan 2006 07:39
15 lines
1671 bytes
1671 bytes
Sorry. Nie doczytalem.
Entry nie posiada wbudowanego mechanizmu undo tak jak Text-Widget
(Control-z).
Wszystko zalezy jak sie zimplementowalo Edit->Undo i co to wogóle w
tym
kontekscia ma znaczyc.
entry .e
pack .e
set undoBuf "value 1"
.e insert 0 $undoBuf
bind .e <Control-KeyPress-z> {
.e delete 0 end
.e inser 0 $undoBuf
}
Re: dziwne zachowanie undo / entry
Author: jartymiak
Date: Thu, 19 Jan 2006 08:56
Date: Thu, 19 Jan 2006 08:56
18 lines
1841 bytes
1841 bytes
Nie szkodzi. Dziekuje za podpowiedzi. Pomoglo cos zupelne innego. Trzeba bylo wylaczyc obsluge niektórych zdarzen wirtualnych: event delete <<Undo>> event delete <<Copy>> event delete <<Paste>> event delete <<Redo> i podpiac pod <Control-Key-z>, <Control-Key-c>, <Control-Key-v>, <Control-Key-y> wlasne procedurki (podpiecie i procedurki mialem zrobione juz wczesniej). Teraz dziala bez zarzutu. Najwyrazniej natrafilem na nieudokumentowany konflikt obslugi zdarzen. Jacek
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads