From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20265 invoked by alias); 18 Nov 2016 16:47:22 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 20181 invoked by uid 89); 18 Nov 2016 16:47:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.6 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=2696, Hx-languages-length:1905, D*dronecode.org.uk, D*org.uk X-HELO: rgout07.bt.lon5.cpcloud.co.uk Received: from rgout07.bt.lon5.cpcloud.co.uk (HELO rgout07.bt.lon5.cpcloud.co.uk) (65.20.0.157) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 18 Nov 2016 16:47:14 +0000 X-OWM-Source-IP: 31.51.207.247 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-Junkmail-Premium-Raw: score=7/50,refid=2.7.2:2016.11.18.162417:17:7.944,ip=,rules=__HAS_FROM, __TO_MALFORMED_2, __TO_NO_NAME, __HAS_CC_HDR, __CC_NAME, __CC_NAME_DIFF_FROM_ACC, __SUBJ_ALPHA_END, __HAS_MSGID, __SANE_MSGID, __HAS_X_MAILER, __IN_REP_TO, __REFERENCES, __FROM_DOMAIN_IN_ANY_CC1, __ANY_URI, __URI_NO_WWW, __NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999, __MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS, __FROM_DOMAIN_IN_RCPT, IN_REP_TO, __MIME_TEXT_P, REFERENCES, BODY_SIZE_7000_LESS, NO_URI_HTTPS, MSG_THREAD, __CC_REAL_NAMES, MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS, LEGITIMATE_NEGATE Received: from localhost.localdomain (31.51.207.247) by rgout07.bt.lon5.cpcloud.co.uk (9.0.019.07.01-1) (authenticated as jonturney@btinternet.com) id 581B49A30198DC36; Fri, 18 Nov 2016 16:47:12 +0000 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 2/5] Fix validation in RootPage Date: Fri, 18 Nov 2016 16:47:00 -0000 Message-Id: <20161118164646.209716-3-jon.turney@dronecode.org.uk> In-Reply-To: <20161118164646.209716-1-jon.turney@dronecode.org.uk> References: <20161118164646.209716-1-jon.turney@dronecode.org.uk> X-SW-Source: 2016-11/txt/msg00010.txt.bz2 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 --- 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