summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-03-29 01:22:42 +0000
committerIan C <ianc@noddybox.co.uk>2005-03-29 01:22:42 +0000
commiteffc648f262bd3bd7b57d4e76db2f768510be55c (patch)
treed77a2e04e58847a3517649ffa83f86b066de08f6 /src/test
parent82f1d860690dc0a2d0210db12344f7ea5e88b6a4 (diff)
Tweaks to Text controls and text handling.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/dialog.rc17
-rw-r--r--src/test/w32dtst.cpp39
2 files changed, 35 insertions, 21 deletions
diff --git a/src/test/dialog.rc b/src/test/dialog.rc
index e96fa9f..d280453 100644
--- a/src/test/dialog.rc
+++ b/src/test/dialog.rc
@@ -1,22 +1,23 @@
#include <windows.h>
#include "dialog.h"
-TESTDLG DIALOG 10, 10, 240, 300
+TESTDLG DIALOG 10, 10, 500, 300
STYLE WS_POPUP | WS_BORDER
CAPTION "Test Dialog"
FONT 8,"MS Shell Dlg"
{
- LTEXT "Text:", IDSTATIC1, 10, 10, 35, 12
- EDITTEXT IDTEXT, 50, 10, 100, 12
- PUSHBUTTON "Try Me!", IDBUTTON, 10, 30, 150, 18
- AUTOCHECKBOX "Check", IDCHECK, 10,50,150,18
- PUSHBUTTON "Quit", IDQUIT, 10,70,150,18
+ PUSHBUTTON "Try Me!", IDBUTTON, 10, 10, 150, 18
+ AUTOCHECKBOX "Check", IDCHECK, 10,30,150,18
+ PUSHBUTTON "Quit", IDQUIT, 10,50,150,18
- EDITTEXT IDLOADTXT, 10, 100, 200, 12
+ EDITTEXT IDLOADTXT, 10, 100, 200, 12, ES_READONLY
PUSHBUTTON "Load ...",IDLOADBUT, 10, 115, 100, 18
- EDITTEXT IDSAVETXT, 10, 140, 200, 12
+ EDITTEXT IDSAVETXT, 10, 140, 200, 12, ES_READONLY
PUSHBUTTON "Save ...",IDSAVEBUT, 10, 155, 100, 18
COMBOBOX IDCOMBO, 10, 180, 100, 100, CBS_SIMPLE | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+
+ LTEXT "Text:", IDSTATIC1, 210, 10, 35, 12
+ EDITTEXT IDTEXT, 250, 10, 100, 100, ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_MULTILINE | ES_WANTRETURN
}
diff --git a/src/test/w32dtst.cpp b/src/test/w32dtst.cpp
index 663c63d..0e09ea2 100644
--- a/src/test/w32dtst.cpp
+++ b/src/test/w32dtst.cpp
@@ -45,6 +45,9 @@ public:
m_check.OnPress
(this,static_cast<W32DLib::W32DLibCallback>(&Test::OnCheck));
+ m_text.OnTextChanged
+ (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnText));
+
m_loadbut.OnPress
(this,static_cast<W32DLib::W32DLibCallback>(&Test::OnLoad));
m_savebut.OnPress
@@ -75,7 +78,7 @@ public:
m_quit.Enable(true);
m_combo.Reset();
- std::cout << "addstring=" << m_combo.AddString("Entry 1") << std::endl;
+ std::cout << "addstring=" << m_combo.AddString(std::string("Entry 1")) << std::endl;
std::cout << "addstring=" << m_combo.AddString("Entry 2") << std::endl;
std::cout << "addstring=" << m_combo.AddString("Entry 3") << std::endl;
@@ -112,24 +115,27 @@ private:
BOOL OnButton(UINT msg, WPARAM wp, LPARAM lp)
{
- std::string txt=m_text.GetText(512);
+ std::string txt=m_text.GetText();
std::cout << "Called OnButton()" << std::endl;
std::cout << "text=" << txt << std::endl;
std::cout << "check=" << m_check.GetState() << std::endl;
- m_static.SetText(txt.c_str());
- SetText((txt+" [Title]").c_str());
- m_combo.AddString(m_combo.GetText().c_str());
+ m_static.SetText(txt);
+ SetText(txt+" [Title]");
+ m_combo.AddString(m_combo.GetText());
+ m_text.AppendText(m_combo.GetText()+"\n");
return TRUE;
}
BOOL OnCheck(UINT msg, WPARAM wp, LPARAM lp)
{
- W32DLib::AutoCheck::EState state=m_check.GetState();
+ bool checked=m_check.GetState();
- std::cout << "Called OnCheck() - state " << state << std::endl;
+ std::cout << "Called OnCheck() - state " << checked << std::endl;
- m_quit.Enable(state==W32DLib::AutoCheck::eChecked);
+ m_quit.Enable(checked);
+ m_load.ReadOnly(checked);
+ m_save.Enable(!checked);
return TRUE;
}
@@ -141,7 +147,7 @@ private:
m_loadpath,
"CPP Files\0*.cpp\0Any File\0*.*\0"))
{
- m_load.SetText(m_loadpath.c_str());
+ m_load.SetText(m_loadpath);
}
return TRUE;
@@ -154,7 +160,7 @@ private:
m_savepath,
NULL))
{
- m_save.SetText(m_savepath.c_str());
+ m_save.SetText(m_savepath);
}
return TRUE;
@@ -167,7 +173,7 @@ private:
std::cout << "Called OnComboSel()" << std::endl;
std::cout << "Sel:selection=" << sel << " (" << str << ")" << std::endl;
- std::cout << "Sel:Window::GetText=" << m_combo.GetText(512) << std::endl;
+ std::cout << "Sel:Window::GetText=" << m_combo.GetText() << std::endl;
return TRUE;
}
@@ -178,14 +184,21 @@ private:
std::cout << "Called OnComboDbl()" << std::endl;
std::cout << "Dbl:selection=" << sel << " (" << str << ")" << std::endl;
- std::cout << "Dbl:Window::GetText=" << m_combo.GetText(512) << std::endl;
+ std::cout << "Dbl:Window::GetText=" << m_combo.GetText() << std::endl;
return TRUE;
}
BOOL OnComboTxt(UINT msg, WPARAM wp, LPARAM lp)
{
std::cout << "Called OnComboSel()" << std::endl;
- std::cout << "Txt:Window::GetText=" << m_combo.GetText(512) << std::endl;
+ std::cout << "Txt:Window::GetText=" << m_combo.GetText() << std::endl;
+ return TRUE;
+ }
+
+ BOOL OnText(UINT msg, WPARAM wp, LPARAM lp)
+ {
+ std::cout << "Called OnText()" << std::endl;
+ std::cout << ":GetText=" << m_text.GetText() << std::endl;
return TRUE;
}
};