SOL9 Sample: IPAddressField

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * IPAddressField.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL++2000
// 2000.02.18

#define COMMONCONTROLS_V6

#include <sol\ApplicationView.h>
#include <sol\IPAddressField.h>
#include <sol\FlowLayout.h>
#include <sol\Static.h>
#include "resource.h"

namespace SOL {

class AppView :public ApplicationView {
private:
  FlowLayout  flowLayout;
  Static    label;
  IPAddressField  addressField;

public:
  AppView(Application& applet, const TCHAR* name, Args& args)
    :ApplicationView(applet, name, args)
  {
    setLayout(&flowLayout);

    Args ar;
    label.create(this, _T("IPAddress"), ar);
    add(label);

    ar.reset();
    ar.set(XmNwidth, 200);
    ar.set(XmNheight, 24);
    addressField.create(this, NULL, ar);

    Dimension dim(200, 24);
    addressField.setPreferredSize(dim);
    addressField.setAddress(255, 255, 255, 0);
    add(addressField);

  addCallback(XmNmenuCallback, IDM_EXIT, this, 
      (Callback)&AppView::exit, NULL);
  //  addressField -> addCallback(XmNactivateCallback, this,
  //    (Callback)exec, NULL);
  }
};

}

//
void  Main(int argc, TCHAR** argv)
{
  ModuleFileName module(argv[0]);
  const TCHAR* name = module.getFileName();
  try {
    Application applet(name, argc, argv);

    Args args;
    args.set(XmNbackground, (COLOR_BTNFACE+1));
    args.set(XmNwidth, 400);
    args.set(XmNheight, 120);

    AppView appView(applet, name, args);
    appView.realize();
    applet.run();

  } catch (Exception& ex) {
    caught(ex);
  } catch (...) {
    caught(UnknownException());
  }
}


Last modified: 1 Feb 2017

Copyright (c) 2017 Antillia.com ALL RIGHTS RESERVED.