Blame test/windowfocus.cxx

Packit 328d5c
//
Packit 328d5c
// "$Id: windowfocus.cxx 10594 2015-02-27 14:10:29Z AlbrechtS $"
Packit 328d5c
//
Packit 328d5c
// Cross-window show/focus test program for the Fast Light Tool Kit (FLTK).
Packit 328d5c
//
Packit 328d5c
// Copyright 1998-2015 by Bill Spitzak and others.
Packit 328d5c
//
Packit 328d5c
// This library is free software. Distribution and use rights are outlined in
Packit 328d5c
// the file "COPYING" which should have been included with this file.  If this
Packit 328d5c
// file is missing or damaged, see the license at:
Packit 328d5c
//
Packit 328d5c
//     http://www.fltk.org/COPYING.php
Packit 328d5c
//
Packit 328d5c
// Please report all bugs and problems on the following page:
Packit 328d5c
//
Packit 328d5c
//     http://www.fltk.org/str.php
Packit 328d5c
//
Packit 328d5c
Packit 328d5c
#include <FL/Fl.H>
Packit 328d5c
#include <FL/Fl_Box.H>
Packit 328d5c
#include <FL/Fl_Double_Window.H>
Packit 328d5c
#include <FL/Fl_Input.H>
Packit 328d5c
Packit 328d5c
static Fl_Double_Window *win1, *win2;
Packit 328d5c
static Fl_Input *input1;
Packit 328d5c
Packit 328d5c
static void popup(Fl_Widget *, void *) {
Packit 328d5c
Packit 328d5c
  win2->position(win1->x() + win1->w(), win1->y());
Packit 328d5c
Packit 328d5c
  win2->show();
Packit 328d5c
  win2->wait_for_expose();
Packit 328d5c
  input1->take_focus();
Packit 328d5c
}
Packit 328d5c
Packit 328d5c
int main(int argc, char **argv) {
Packit 328d5c
Packit 328d5c
  win1 = new Fl_Double_Window(300, 200);
Packit 328d5c
  win1->label("show() focus test");
Packit 328d5c
Packit 328d5c
  Fl_Box *b = new Fl_Box(10, 10, 280, 130);
Packit 328d5c
  b->label("Type something to pop the subwindow up. "
Packit 328d5c
	   "The focus should stay on the input, "
Packit 328d5c
	   "and you should be able to continue typing.");
Packit 328d5c
  b->align(FL_ALIGN_WRAP | FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
Packit 328d5c
Packit 328d5c
  input1 = new Fl_Input(10, 150, 150, 25);
Packit 328d5c
  input1->when(FL_WHEN_CHANGED);
Packit 328d5c
  input1->callback(popup);
Packit 328d5c
Packit 328d5c
  win1->end();
Packit 328d5c
Packit 328d5c
  win2 = new Fl_Double_Window(300, 200);
Packit 328d5c
  win2->label("window2");
Packit 328d5c
  win2->end();
Packit 328d5c
Packit 328d5c
  win1->show(argc,argv);
Packit 328d5c
Packit 328d5c
  return Fl::run();
Packit 328d5c
}
Packit 328d5c
Packit 328d5c
//
Packit 328d5c
// End of "$Id: windowfocus.cxx 10594 2015-02-27 14:10:29Z AlbrechtS $".
Packit 328d5c
//