]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
added newtFormGetCurrent()
authorewt <ewt>
Mon, 17 Jun 1996 15:16:00 +0000 (15:16 +0000)
committerewt <ewt>
Mon, 17 Jun 1996 15:16:00 +0000 (15:16 +0000)
form.c

diff --git a/form.c b/form.c
index 5f70988b07abdc7844f4513704e7c69e1ccbfbc5..5ca549173f23d19fc061c83bfaf4e874611b3b2e 100644 (file)
--- a/form.c
+++ b/form.c
@@ -1,3 +1,4 @@
+#include <slang/slang.h>
 #include <stdarg.h>
 #include <stdlib.h>
 
@@ -82,6 +83,12 @@ newtComponent newtForm(newtComponent vertScrollbar) {
     return co;
 }
 
+newtComponent newtFormGetCurrent(newtComponent co) {
+    struct form * form = co->data;
+
+    return form->elements[form->currComp].co;
+}
+
 void newtFormSetHeight(newtComponent co, int height) {
     struct form * form = co->data;
 
@@ -108,10 +115,6 @@ void newtFormAddComponent(newtComponent co, newtComponent newco) {
 
     form->numComps++;
 
-    if ((newco->top + newco->height - co->top) > form->numRows) {
-       form->numRows = newco->top + newco->height - co->top;
-    }
-
     if (co->left == -1) {
        co->left = newco->left;
        co->top = newco->top;
@@ -141,6 +144,11 @@ void newtFormAddComponent(newtComponent co, newtComponent newco) {
                co->height = (newco->top + newco->height) - co->top;
        }
     }
+
+    if ((newco->top + newco->height - co->top) > form->numRows) {
+       form->numRows = newco->top + newco->height - co->top;
+    }
+
 }
 
 void newtFormAddComponents(newtComponent co, ...) {