From 26ab0079f0356b3caecf0ca04cc0263b7cff4ccd Mon Sep 17 00:00:00 2001 From: Maurilio Longo Date: Tue, 21 Nov 2000 16:45:36 +0000 Subject: [PATCH] 2000-11-21 17:42 GMT+1 Maurilio Longo --- harbour/ChangeLog | 8 ++++++++ harbour/contrib/mysql/tsqlbrw.prg | 27 ++++++++++++++++----------- harbour/source/rtl/memoedit.prg | 2 +- harbour/source/rtl/teditor.prg | 16 ++++++++++++++++ 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d4954f125e..ac44949bab 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,11 @@ +2000-11-21 17:42 GMT+1 Maurilio Longo + * source/rtl/teditor.prg + + added ::LoadText() method + * source/rtl/memoedit.prg + ! fixed small bug with KEYBOARD statement + * contrib/mysql/tsqlbrw.prg + * little changes. + 2000-11-20 23:11 GMT+1 Maurilio Longo * source/rtl/tbrowse.prg ! ::PageDown() fixed bug introduced with previous change diff --git a/harbour/contrib/mysql/tsqlbrw.prg b/harbour/contrib/mysql/tsqlbrw.prg index 558a3bfe58..8e14d1e32c 100644 --- a/harbour/contrib/mysql/tsqlbrw.prg +++ b/harbour/contrib/mysql/tsqlbrw.prg @@ -247,14 +247,19 @@ METHOD EditField() CLASS TBrowseSQL //@ 10,((76 - Len(::oCurRow:FieldName(oCol:nFieldNum)) / 2) SAY " " + (::oCurRow:FieldName(oCol:nFieldNum)) + " " /* edit the memo field */ - cMemo := MemoEdit(::oCurRow:FieldGet(oCol:nFieldNum), 11, 11, 21, 68, .T., "xmemo") + cMemo := MemoEdit(::oCurRow:FieldGet(oCol:nFieldNum), 11, 11, 21, 68, .T.) - if Lastkey() == K_ALT_W - ::oCurRow:FieldPut(oCol:nFieldNum, cMemo) + if Lastkey() == K_CTRL_END + ::oCurRow:FieldPut(oCol:nFieldNum, cMemo) + + /* NOTE: To do in a better way */ + if !::oQuery:Update(::oCurRow) + Alert(Left(::oQuery:Error(), 60)) + endif endif - RestScreen(10, 10, 22, 69, cMemoBuff) - + RestScreen(10, 10, 22, 69, cMemoBuff) + else // Create a corresponding GET // NOTE: I need to use ::oCurRow:FieldPut(...) when changing values since message redirection doesn't work at present @@ -269,20 +274,19 @@ METHOD EditField() CLASS TBrowseSQL //setcursor( iif( ReadInsert(), SC_INSERT, SC_NORMAL ) ) ReadModal(aGetList) //setcursor( SC_NONE ) - endif + /* NOTE: To do in a better way */ + if !::oQuery:Update(::oCurRow) + Alert(Left(::oQuery:Error(), 60)) + endif - /* NOTE: To do in a better way */ - if !::oQuery:Update(::oCurRow) - Alert(Left(::oQuery:Error(), 60)) endif if !::oQuery:Refresh() Alert(::oQuery:Error()) endif - ::inValidate() - ::refreshAll():forceStable() + ::RefreshAll() // Check exit key from get nKey := LastKey() @@ -381,6 +385,7 @@ METHOD BrowseTable(lCanEdit, aExitKeys) CLASS TBrowseSQL otherwise ::KeyboardHook(nKey) + endcase enddo diff --git a/harbour/source/rtl/memoedit.prg b/harbour/source/rtl/memoedit.prg index 1fa497fb93..12cc39647f 100644 --- a/harbour/source/rtl/memoedit.prg +++ b/harbour/source/rtl/memoedit.prg @@ -74,7 +74,7 @@ FUNCTION MemoEdit(cString,; if oEd:lSaved cString := oEd:GetText() // dbu tests for LastKey() == K_CTRL_END, so I try to make it happy - KEYBOARD K_CTRL_END + KEYBOARD Chr(K_CTRL_END) Inkey() endif endif diff --git a/harbour/source/rtl/teditor.prg b/harbour/source/rtl/teditor.prg index 7e4217ee0d..1fda073a29 100644 --- a/harbour/source/rtl/teditor.prg +++ b/harbour/source/rtl/teditor.prg @@ -83,6 +83,7 @@ CLASS TEditor nTabSize) METHOD LoadFile(cFileName) // Load cFileName into active editor + METHOD LoadText(cString) // Load cString into active editor METHOD SaveFile() // Save active file (not for MemoEdit() emulation) METHOD AddLine(cLine, lSoftCR) // Add a new Line of text at end of current text @@ -340,6 +341,21 @@ METHOD LoadFile(cFileName) CLASS TEditor return Self +METHOD LoadText(cString) CLASS TEditor + + ::aText := Text2Array(cString, iif(::lWordWrap, ::nNumCols, nil)) + ::naTextLen := Len(::aText) + + if ::naTextLen == 0 + AAdd(::aText, TTextLine():New()) + ::naTextLen++ + endif + + ::MoveCursor(K_CTRL_PGUP) + +return Self + + // Saves file being edited, if there is no file name does nothing, returns .T. if OK METHOD SaveFile() CLASS TEditor