Commit cafa1e3660e5ae58a7f9f561b3a128c80fd46619

Authored by Perry Werneck
1 parent 0944f629
Exists in master

Fix #1 - Inclui métodos para ler/gravar o endereço do cursor.

src/native/get.cc
@@ -126,6 +126,17 @@ @@ -126,6 +126,17 @@
126 126
127 } 127 }
128 128
  129 + int tn3270_get_cursor_addr(h3270::session *ses) {
  130 +
  131 + try {
  132 + return (int) ses->get_cursor_addr();
  133 + } catch(std::exception &e) {
  134 + tn3270_lasterror = e.what();
  135 + }
  136 + return -1;
  137 +
  138 + }
  139 +
129 int tn3270_get_url(h3270::session *ses, char* str, int strlen) { 140 int tn3270_get_url(h3270::session *ses, char* str, int strlen) {
130 141
131 try { 142 try {
src/pw3270-sharp/pw3270-sharp.cs
@@ -114,6 +114,9 @@ namespace pw3270 { @@ -114,6 +114,9 @@ namespace pw3270 {
114 extern static int tn3270_set_cursor_addr(IntPtr Session, int addr); 114 extern static int tn3270_set_cursor_addr(IntPtr Session, int addr);
115 115
116 [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] 116 [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)]
  117 + extern static int tn3270_get_cursor_addr(IntPtr Session);
  118 +
  119 + [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)]
117 extern static int tn3270_enter(IntPtr Session); 120 extern static int tn3270_enter(IntPtr Session);
118 121
119 [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] 122 [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)]
@@ -409,6 +412,28 @@ namespace pw3270 { @@ -409,6 +412,28 @@ namespace pw3270 {
409 } 412 }
410 413
411 /// <summary> 414 /// <summary>
  415 + /// Get cursor address
  416 + /// </summary>
  417 + ///
  418 + public int GetCursorPosition() {
  419 + return tn3270_get_cursor_addr(hSession);
  420 + }
  421 +
  422 + /// <summary>
  423 + /// Cursor address
  424 + /// </summary>
  425 + ///
  426 + public int CursorPosition {
  427 + set {
  428 + tn3270_set_cursor_addr(hSession, value);
  429 + }
  430 + get {
  431 + return tn3270_get_cursor_addr(hSession);
  432 + }
  433 + }
  434 +
  435 +
  436 + /// <summary>
412 /// Send "Enter" key 437 /// Send "Enter" key
413 /// </summary> 438 /// </summary>
414 /// 439 ///