summaryrefslogtreecommitdiff
path: root/test/input.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-11-02 13:57:56 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-11-02 13:57:56 +0000
commit8979617990dca283bbf00b7fd4e5fa4a9f6e2c7f (patch)
tree3d4480787506a6bd8f190a87c483187a2cda38ef /test/input.cxx
parentcddb39a066ba484ecf44dceb0bdb2b930a0764c9 (diff)
STR #1052: updated color handling in test programs. If you are planning on creating labels based on foreground or background color, you should load the colors *before* creating the user interface. This is done by calling:
Fl::args(arc, argv); Fl::set_system_colors(); git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4626 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/input.cxx')
-rw-r--r--test/input.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/input.cxx b/test/input.cxx
index 97b857332..784941f90 100644
--- a/test/input.cxx
+++ b/test/input.cxx
@@ -62,9 +62,9 @@ void button_cb(Fl_Widget *,void *) {
void color_cb(Fl_Widget* button, void* v) {
Fl_Color c;
switch ((int)v) {
- case 0: c = FL_WHITE; break;
+ case 0: c = FL_BACKGROUND2_COLOR; break;
case 1: c = FL_SELECTION_COLOR; break;
- default: c = FL_BLACK; break;
+ default: c = FL_FOREGROUND_COLOR; break;
}
uchar r,g,b; Fl::get_color(c, r,g,b);
if (fl_color_chooser(0,r,g,b)) {
@@ -75,13 +75,17 @@ void color_cb(Fl_Widget* button, void* v) {
}
int main(int argc, char **argv) {
+ // the following two lines set the correct color scheme, so that
+ // calling fl_contrast below will return good results
+ Fl::args(argc, argv);
+ Fl::get_system_colors();
Fl_Window *window = new Fl_Window(400,400);
int y = 10;
input[0] = new Fl_Input(70,y,300,30,"Normal:"); y += 35;
input[0]->tooltip("Normal input field");
// input[0]->cursor_color(FL_SELECTION_COLOR);
- // input[0]->maximum_size(20);
+ // input[0]->maximum_size(20);
// input[0]->static_value("this is a testgarbage");
input[1] = new Fl_Float_Input(70,y,300,30,"Float:"); y += 35;
input[1]->tooltip("Input field for floating-point number");