Open main menu

CDOT Wiki β

Framework Checkbox Tester - OOP344 21013


OOP344 | Weekly Schedule | Student List | Teams | Project | Student Resources

#include "confw.h"
#include "fwdialog.h"
#include "fwcheck.h"

#include <cstring>
#include <cctype>
#include <iostream>
using namespace std;
void Move(FWBorder &Br);

int main() {
  int insert = 1;
  int key;
  bool done = false;
  iol_init();
  FWDialog Screen;
  FWDialog F(&Screen,5, 5, 70, 15, true);
  FWCheck chb(true,"[X]","Check Box", 3,3);
  //FWCheck* chbptr; Un-commnent this line and line 27 and 31 and comment line 30
  // for alternative way of accessing the checkbox's falg
  Screen<< new FWLabel("Esc: EXIT ", 0, 0);
  F<<chb
   <<new FWLabel("Checked",3, 17, 15)
   <<new FWCheck(false,"(O)","Radio Button", 5, 3, true)
   <<new FWLabel("Not Checked", 5, 20, 15);
  F.draw(FW_REFRESH);
  //chbptr = (FWCheck*)&F[3];
  while(!done){
    F[1].set(chb.checked()?"Checked": "Not Checked");
    F[3].set(bool(*((bool*)F[2].data()))?"Checked": "Not Checked");
    //F[3].set(chbptr->checked()?"Checked": "Not Checked");
    key = F.edit();
    switch(key){
      case ESCAPE_KEY:
        done = true;
        break;
    }
  }
  iol_end();

  return 0;
}