SOL9 Sample: ProgressBar

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * ProgressBar.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\PaintDC.h>
#include <sol\ProgressBar.h>
#include "resource.h"

namespace SOL {

class AppView :public ApplicationView {
private:
  ProgressBar  progress;

public:
  /**
   * Constructor
   */
  AppView(Application& applet, const TCHAR* label, Args& args)
  :ApplicationView(applet, label, args)
  {  
    Args ar;
    ar.set(XmNx, 10);
    ar.set(XmNy, 10);
    ar.set(XmNwidth, 200);
    ar.set(XmNheight, 20);
    progress.create(this, NULL, ar);
    progress.setRange(0, 20);
    progress.setStep(1);

    setTimer(10, 100, NULL);
    addEventHandler(WM_TIMER, this, 
      (Handler)&AppView::timer, NULL);
    addEventHandler(WM_CLOSE, this, 
      (Handler)&AppView::close, NULL);
    
    addCallback(XmNmenuCallback, IDM_EXIT, this,
      (Callback)&AppView::exit, NULL);

  }

private:
  long timer(Event& event) 
  {
    progress.stepIt();
    return 0;
  }
private:
  long close(Event& event) 
  {
    showMessageDialog(_T("Confirmation"), _T("Are you sure to close this window! "));
    killTimer(10);
    destroyWindow();
    return 0;
  }
};

}

//
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(XmNwidth, 300);
    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.