public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH setup 2/5] Fix validation in RootPage
Date: Fri, 18 Nov 2016 16:47:00 -0000	[thread overview]
Message-ID: <20161118164646.209716-3-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20161118164646.209716-1-jon.turney@dronecode.org.uk>

RootPage is supposed to disable the next button if the rootdir edit box is
empty, but this currently doesn't work.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
 root.cc | 19 ++++++++++++++-----
 root.h  |  4 ++++
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/root.cc b/root.cc
index ec2588a..695590a 100644
--- a/root.cc
+++ b/root.cc
@@ -39,6 +39,7 @@ static const char *cvsid =
 #include "msg.h"
 #include "package_db.h"
 #include "mount.h"
+#include "propsheet.h"
 
 #include "getopt++/StringOption.h"
 
@@ -64,11 +65,14 @@ static int su[] = { IDC_ROOT_SYSTEM, IDC_ROOT_USER, 0 };
 
 static string orig_root_dir;
 
-static void
-check_if_enable_next (HWND h)
+void
+RootPage::check_if_enable_next (HWND h)
 {
-  EnableWindow (GetDlgItem (h, IDOK),
-		egetString (h, IDC_ROOT_DIR).size() && root_scope);
+  DWORD ButtonFlags = PSWIZB_BACK;
+  // if there's something in the root dir box, and we have a scope, enable next
+  if (egetString (h, IDC_ROOT_DIR).size() && root_scope)
+    ButtonFlags |= PSWIZB_NEXT;
+  GetOwner ()->SetButtons (ButtonFlags);
 }
 
 static void
@@ -76,7 +80,6 @@ load_dialog (HWND h)
 {
   rbset (h, su, root_scope);
   eset (h, IDC_ROOT_DIR, get_root_dir ());
-  check_if_enable_next (h);
 }
 
 static void
@@ -269,6 +272,12 @@ RootPage::OnInit ()
   load_dialog (GetHWND ());
 }
 
+void
+RootPage::OnActivate ()
+{
+  check_if_enable_next (GetHWND ());
+}
+
 bool
 RootPage::wantsActivation() const
 {
diff --git a/root.h b/root.h
index 6e89fb9..326a930 100644
--- a/root.h
+++ b/root.h
@@ -16,9 +16,13 @@ public:
   virtual bool OnMessageCmd (int id, HWND hwndctl, UINT code);
   virtual void OnInit ();
   virtual bool wantsActivation() const;
+  virtual void OnActivate ();
   virtual long OnNext ();
   virtual long OnBack ();
   virtual long OnUnattended ();
+
+ private:
+  void check_if_enable_next (HWND h);
 };
 
 #endif /* SETUP_ROOT_H */
-- 
2.8.3

  parent reply	other threads:[~2016-11-18 16:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-18 16:47 [PATCH setup 0/5] Various setup patches Jon Turney
2016-11-18 16:47 ` [PATCH setup 3/5] Ignore malformed lines in a site-list Jon Turney
2016-11-18 16:47 ` Jon Turney [this message]
2016-11-18 16:47 ` [PATCH setup 4/5] Start chooser in "Pending" view if this is not a first time installation Jon Turney
2016-11-18 16:47 ` [PATCH setup 5/5] Simplify PickView::insert_pkg Jon Turney
2016-11-18 16:47 ` [PATCH setup 1/5] Give search edit box autohscroll style Jon Turney
2016-11-19 16:10 ` [PATCH setup 0/5] Various setup patches Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161118164646.209716-3-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).