From cafa1e3660e5ae58a7f9f561b3a128c80fd46619 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Tue, 11 Apr 2017 15:51:33 -0300 Subject: [PATCH] Fix #1 - Inclui métodos para ler/gravar o endereço do cursor. --- src/native/get.cc | 11 +++++++++++ src/pw3270-sharp/pw3270-sharp.cs | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 0 deletions(-) diff --git a/src/native/get.cc b/src/native/get.cc index 505c811..c95c337 100644 --- a/src/native/get.cc +++ b/src/native/get.cc @@ -126,6 +126,17 @@ } + int tn3270_get_cursor_addr(h3270::session *ses) { + + try { + return (int) ses->get_cursor_addr(); + } catch(std::exception &e) { + tn3270_lasterror = e.what(); + } + return -1; + + } + int tn3270_get_url(h3270::session *ses, char* str, int strlen) { try { diff --git a/src/pw3270-sharp/pw3270-sharp.cs b/src/pw3270-sharp/pw3270-sharp.cs index 618603a..fc55098 100644 --- a/src/pw3270-sharp/pw3270-sharp.cs +++ b/src/pw3270-sharp/pw3270-sharp.cs @@ -114,6 +114,9 @@ namespace pw3270 { extern static int tn3270_set_cursor_addr(IntPtr Session, int addr); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] + extern static int tn3270_get_cursor_addr(IntPtr Session); + + [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] extern static int tn3270_enter(IntPtr Session); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] @@ -409,6 +412,28 @@ namespace pw3270 { } /// + /// Get cursor address + /// + /// + public int GetCursorPosition() { + return tn3270_get_cursor_addr(hSession); + } + + /// + /// Cursor address + /// + /// + public int CursorPosition { + set { + tn3270_set_cursor_addr(hSession, value); + } + get { + return tn3270_get_cursor_addr(hSession); + } + } + + + /// /// Send "Enter" key /// /// -- libgit2 0.21.2