Ejemplo n.º 1
0
AppWindow :: AppWindow()
{												   
	CreateWindow(OpmStdFrame);					   // Create the frame
	SetCaption("Errors & Conditons Sample");					   // Set captions
	SetSwitchTitle("ErrorDemo");
	SetIcon(icon = new wIcon(ResIcon, ITriangle));   // Set the app's icon

	// This section create a menu bar and then adds items to the 
	// sub menu itself.  It is also possible to construct the menu
	// from the resource file if desired

	menubar = new wMenu(this, MBarError, "~Error\\~Condition\\~Help\\");
	menubar->SetSubMenuItems(MBarError, MiFatal, "~Fatal;~Error;~Warning;");
	menubar->SetSubMenuItems(MBarCondition, MiRecord, "~Record...;~Tell...;");
	menubar->SetSubMenuItems(MBarHelp, MiHelp, "~Help for help...;~General help...;Help ~index;");

	// Create a temporary system menu object for the purposes of adding
	// a seperator and the "About..." menu item.

	wSysMenu sm(this);
	sm.AppendSeparator();
	sm.AppendItem(ScAbout, "~About...");

	// Add event handlers for the menu items.  

	AddMessageHandler(this, EVENTMETHOD(AppWindow, ProcError), 
	                  WM_COMMAND, MiFatal, MiWarning);	
	
	AddMessageHandler(this, EVENTMETHOD(AppWindow, ProcRecordTell), 
	                  WM_COMMAND, MiRecord, MiTell);	

	AddMessageHandler(this, EVENTMETHOD(AppWindow, ProcHelp), 
	                  WM_COMMAND, MiHelp, MiHelpIndex);	

	AddMessageHandler(this, EVENTMETHOD(AppWindow, ProcAbout), 
	                  WM_COMMAND, ScAbout);	

	// connect to HelpManager object

	SetFrameID(AppFrame);
	AssociateHelp();	
	help = ThisThread->HelpInstance();

	// set the address of the frame window in the app's dictionary so that
	// the error dialog can use it as its parent window.

	ThisApp->PutObject("AppFrame", this);

	Show();				   // Make the frame visible
	ToTop();
}
logical pc_SDB_Reference :: StoreAll (DBStructDef *strdefptr )
{
  DBFieldDef *dbflddef = NULL;
  int32       indx0    = strdefptr->get_base_info().get_count() +
                         strdefptr->get_attr_info().get_count();
  int32       count    = indx0 + strdefptr->get_refr_info().get_count();
  logical     term     = NO;
BEGINSEQ
  DeleteSet();                                       SDBCERR
  
  while ( indx0 < count )
    if ( dbflddef = strdefptr->GetEntry(++indx0) )
    {
      ToTop();
      Add();                                         SDBCERR
      if ( Store(dbflddef) )
        term = YES;
    }
Ejemplo n.º 3
0
AppWindow :: AppWindow()
{	
	CreateWindow(FaTitleBar | FaTaskList | FaSysMenu | FaSizeBorder | FaMinMax);
	SetCaption("FormWindow Demo");					  // Set captions
	SetSwitchTitle("FormWindow Demo Program");
	SetIcon(icon = new wIcon(ResIcon, I_FORMDEMO));   // Set the app's icon

	// This section create a menu bar and then adds items to the
	// sub menu itself.  It is also possible to construct the menu
	// from the resource file if desired

	menubar = new wMenu(this, 100, "~Form\\~Help\\");
	menubar->SetSubMenuItems(SM_HELP, MI_HELP, "~Help for help...;~General help...;~Keys help...;Help ~index;");
	
	// connect to HelpManager object
	AssociateHelp();	
	help = ThisThread->HelpInstance();

	np = new FormNoteBook(this, IdNotebook, wPointl(2, 0, DlgUnits),
						 wDimension(296, 150, DlgUnits), WsVisible | BkSpiralBinding);

	np->SetMajorTabDimension(wDimension(42, 12, DlgUnits));
	np->SetMinorTabDimension(wDimension(40, 12, DlgUnits));
	wNoteBookPageList *pages = np->Pages();
	data = new FormData;

	forms[0]  = new StringForm(pages, data);
	forms[1]  = new CharForm(pages, data);
	forms[2]  = new MLEStringForm(pages, data);
	forms[3]  = new DateForm(pages, data);
	forms[4]  = new TimeForm(pages, data);
	forms[5]  = new ShortForm(pages, data);
	forms[6]  = new LongForm(pages, data);
	forms[7]  = new FloatForm(pages, data);
	forms[8]  = new MoneyForm(pages, data);
	forms[9]  = new ButtonForm(pages, data);
	forms[10] = new ListForm(pages, data);

	ChangeFrameSize( CalcFrameSize(wDimension(310, 160, DlgUnits)) );
	ChangePosition(PosCenter);
	np->GotoPage((*pages)[1]);
	Show();
	ToTop();
}
Ejemplo n.º 4
0
long SearchDlg :: InitDlg(wInitDlgMsg)
{
	srch = new wEntry(this, SEARCH);
	repl = new wEntry(this, REPLACE);
	cs = new wCheckBox(this, CASE);
	srch->SetText(*search);
	repl->SetText(*replace);

	// SELECT ALL CURRENT FIND TEXT
	if (!search->IsBlank())
		srch->SetSelection(wRange(0, search->Length()));

	cs->SetCheck(*sens);		// SET CHECKBOX TO PREVIOUS STATE
	ChangePosition(PosCenter, OwnerWindow());	// CENTER DIALOG WINDOW IN PARENT
	ToTop();

	srch->SetFocus();	// SET FOCUS TO THE ENTRY FIELD
	return TRUE;
}
Ejemplo n.º 5
0
Editor :: Editor() : wMdiDesktop(W_MENU, W_TILE, W_CASCADE, W_FIRST)
{
	static Accel	a[] = {
		{AsAlt | AsVirtualKey, VkBackspace, E_UNDO},
		{AsShift,	  VkDelete, E_CUT},
		{AsControl,  VkInsert, E_COPY},
		{AsShift,    VkInsert, E_PASTE},
		{AsChar | AsControl,   'f',          E_FIND},
		{AsVirtualKey,          VkF3,        F_QUIT},
		{AsChar | AsControl,   'o',          F_OPEN},
		{AsChar | AsControl,   's',          F_SAVE},
		{AsChar | AsControl,   'n',          F_NEW},
		{AsChar | AsControl,   'a',          E_SELECTALL}
	};

	// COLORS STRING FOR MENU
	char *MENUCOLOR="~White;~Black;B~lue;~Red;~Pink;~Green;~Cyan;~Yellow;\
~Dark Gray;Dark Bl~ue;Dark R~ed;Dark P~ink;Dark Gree~n;Dark Cya~n;Br~own;P~ale Gray";

	char *OPTIONS="~Undo\tAlt+Backspace;-;Cu~t\tShift+Delete;~Copy\tCtrl+Insert;\
~Paste\tShift+Insert;-;Cl~ear;-;~Find...\tCtrl+F;Select ~all\tCtrl+A;";

	CreateWindow(OpmStdFrame);

	SetCaption("MDI Editor");
	SetSwitchTitle("MDI Editor");
	
	menu = new wMenu(this, F_MENU, "~File\\~Edit\\~Options\\~Window\\");
	menu->SetSubMenuItems(F_MENU, F_NEW, "~New\tCtrl+N;~Open...\tCtrl+O;-;~Save\tCtrl+S;Save ~As...;~Close;-;~Quit\tF3;");
	menu->SetSubMenuItems(E_MENU, E_UNDO, OPTIONS);
	menu->AppendSubMenu( O_MENU, O_FOREG, "~Foreground");
	menu->AppendSubMenu( O_MENU, O_BACKG, "~Background");
	menu->SetSubMenuItems(O_MENU, O_FONT, "F~ont");
	menu->SetSubMenuItems(O_MENU, O_TABSTOPS, "~Tabstops");
	menu->SetSubMenuItems(O_MENU, O_WWRAP, "~Word Wrap");
	menu->SetSubMenuItems(O_FOREG, O_FGCOLOR, MENUCOLOR);
	menu->SetSubMenuItems(O_BACKG, O_BGCOLOR, MENUCOLOR);
	menu->SetSubMenuItems(W_MENU, W_TILE, "~Tile;~Cascade;-;");

	SetIcon(icon = new wIcon(ResIcon, I_DOC));   

	accel = new wAccelTable(this);
	accel->Set(a, 10);
	cs = 0;

	fgc = wColor(ClrBlack);
	bgc = wColor(ClrWhite);
	tab = 64;
	wwrap = FALSE;

	wPresSpace	ps(this);
	font = new wFont((wStdFont)0, NormalFont, &ps);

	int lp;

	for (lp=0 ; lp < 16 && carr[lp] != (long)fgc; lp++)
		; 

	menu->CheckItem(O_FGCOLOR + lp);
	for (lp=0 ; lp < 16 && carr[lp] != (long)bgc; lp++)
		;
 
	menu->CheckItem(O_BGCOLOR + lp);
	Show();
	ToTop();
}