本文整理汇总了C++中CDialog::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ CDialog::draw方法的具体用法?C++ CDialog::draw怎么用?C++ CDialog::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDialog
的用法示例。
在下文中一共展示了CDialog::draw方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
bool done = false;
int key = 0;
int i = 0;
CDialog Screen;
for(int k = 1; k < console.getRows(); k += 2)
{
for(int m = 0; m < console.getCols() - 10; m += 10)
{
Screen << new CLabel((i = !i) ? "Hello" : "Hi", k, m, 9);
}
}
Screen.draw();
CDialog D(&Screen, 5, 10, 50, 15, true, "+-+|+-+|");
CLabel L("A Non-dynamic Label goes here", 5, 4);
Screen << new CLabel("Dialog and Label Tester", 0, 0);
D.add(new CLabel("Testing Read Only Dialog", 1, 12));
D << new CLabel("Another Dyanmic label goes here, and I want to make sure it will be trimmed", 3, 3,
45) << L;
int mesIndx = D.add(new CLabel(7, 5, 40));
D << new CLabel("ESC to exit, F6 to Move, other to loop", 9, 3);
D[mesIndx].set("Setting the message to see what happens");
Screen.draw();
D.draw();
while(!done)
{
key = D.edit(mesIndx + 1);
i++;
sprintf((char*)D[mesIndx].data(), "LOOP No: %d", i);
switch(key)
{
case ESCAPE:
done = true;
break;
case F(6):
D.move();
break;
}
}
D.hide();
console.pause();
return 0;
}
示例2: test_4_Button
int test_4_Button() {
bool done = false;
int key = 0;
int i = 0;
int fn = C_FULL_FRAME;
CDialog Screen;
for(int k=2;k<console.getRows();k+=2){
for(int m=0;m<console.getCols()-10;m+=10){
Screen<<new CLabel((i=!i)?"Hello": "Hi",k, m, 9);
}
}
Screen<<new CLabel(">>>>>> Dialog and Button Tester <<<<<<<<", 0, (console.getCols()-40)/2);
Screen.draw();
CDialog D(&Screen, 5, 10, 50, 15, true, "+-+|+-+|");
CButton Inc("Increase",9,10);
CButton Dec("Decrease",9,30);
D.add(new CLabel("Testing Buttons (bordered)",1, 12,30));
D.add(new CLabel("Press F10 to toggle button borders visiblity",3,3));
D.add(new CLabel("Press F6 to move ",4,15));
int mesIndx = D.add(new CLabel(7, 24, 10));
int incNum = D.add(Inc) + 1;
int decNum = D.add(Dec) + 1;
D << new CLabel("Press Escape to exit", 12, 15);
D[mesIndx].set("100");
while(!done){
key = D.edit(fn);
switch(key){
case ESCAPE:
done = true;
break;
case F(10):
Inc.visible(!Inc.visible());
Dec.visible(!Dec.visible());
D[0].set(Inc.visible() ? "Testing Buttons (bordered)" : "Testing Buttons (no border)");
D.refresh();
break;
case F(6):
D.move();
break;
case C_BUTTON_HIT:
if(&D.curField() == &Inc){
i++;
fn = incNum;
}
else{
i--;
fn = decNum;
}
sprintf((char*)D[mesIndx].data(),"%d",i);
D[mesIndx].draw();
break;
}
}
D.hide();
console.pause();
return 0;
}
示例3: guiStartInsertBook
void guiStartInsertBook(){
_insertingBook = true;
txtName.set("");
txtAuthor.set("");
txtPublisher.set("");
txtRDate.set("");
txtISBN.set("0");
txtRating.set("0");
scrBook.draw();
}
示例4: main
int main(){
bool done = false;
int key = 0;
int i = 0;
bool insert = true;
char str[81] = "I want to edit this thing!";
CDialog Screen;
for(int k=1;k<console.getRows();k+=2){
for(int m=0;m<console.getCols()-10;m+=10){
Screen<<new CLabel((i=!i)?"Hello": "Hi",k, m, 9);
}
}
Screen<<new CLabel("Dialog and Line Editor Tester ", 0, 0);
CDialog D(&Screen, 5, 10, 50, 15, true, "+-+|+-+|");
CLabel L("Enter some text down here:",6, 4);
Screen.draw();
D.add(new CLabel("Testing Label and Line edit",1, 12));
D << new CLabel("Name: ", 4, 3)
<< new CLineEdit(4,9,20,40,&insert)
<< new CLabel("Surname: ", 5, 3)
<< new CLineEdit(5,12,20,50,&insert)<< L
<< new CLineEdit(str,7,4,40,80, &insert, true);
int mesIndx = D.add(new CLabel(10, 5, 40));
D << new CLabel("Press ESC or F2 to exit, press F6 to Move", 2, 3);
D[mesIndx].set("Setting the message to see what happens");
D.draw();
while(!done){
key = D.edit(mesIndx+ 1);
i++;
sprintf((char*)D[mesIndx].data(), "LOOP No: %d", i);
switch(key){
case ESCAPE:
case F(2):
done = true;
break;
case F(3):
D[mesIndx].set("Setting the message to something more than 40 characters to see what happens");
break;
case F(6):
D.move();
break;
}
}
console.clear();
console.display("First Lineedit data:", 8, 1);
console.display((char*)D[2].data(), 9, 0);
console.display("Second Lineedit data:", 10, 1);
console.display((char*)D[4].data(), 11, 0);
console.display("Third Linedit data:", 14, 1);
console.display((char*)D[6].data(), 15, 0);
console.pause();
return 0;
}
示例5: CLabel
SceneBookDatabase() :
_insertingBook(false),
_deletingBook(false),
insert(true),
scrMain(),
scrBook(&scrMain, 5, 10, 50, 15, true, "+-+|+-+|"),
lblName("Name: ", 4, 3),
lblAuthor("Author: ", 5, 3),
lblPublisher("Publisher: ", 6, 3),
lblRDate("Release Date: ", 7, 3),
lblISBN("ISBN: ", 8, 3),
lblRating("Rating: ", 9, 3),
lblMessage("Welcome to use Team-T's Program", 11, 2),
lblMessage2("", 12, 2),
lblFunctionKeys1(" F3=EXIT F5=SEARCH F6=INSERT F7=GO FIRST F8=GO LAST F9=COMMIT F10=DISCARD ", 23, 0),
lblFunctionKeys2(" PAGEUP=PREV RECORD PAGEDOWN=NEXT RECORD F11=DELETE RECORD ", 24, 0),
txtName(4, 13, 20, 40, &insert),
txtAuthor(5, 11, 20, 70, &insert),
txtPublisher(6, 14, 20, 70, &insert),
txtRDate(7, 17, 20, 10, &insert),
txtISBN(8, 9, 20, 10, &insert),
txtRating(9, 11, 20, 10, &insert)
{
int i = 0;
for (int k = 1; k<console.getRows(); k += 2){
for (int m = 0; m<console.getCols() - 10; m += 10){
scrMain << new CLabel((i = !i) ? "Hello" : "Hi", k, m, 9);
}
}
scrMain << new CLabel("Dialog and Line Editor Tester ", 0, 0) << lblFunctionKeys1 << lblFunctionKeys2;
scrMain.draw();
scrBook.add(new CLabel("Book Database", 1, 12));
scrBook << lblName << txtName << lblAuthor << txtAuthor << lblPublisher << lblMessage << lblMessage2 << txtPublisher << lblRDate << txtRDate << lblISBN << txtISBN << lblRating << txtRating;
scrBook.draw();
}
示例6: main
int main() {
int insert = 1;
int key;
bool done = false;
char si[] = "Selected Index: ";
CDialog Screen;
CDialog FD(&Screen,5, 5, 35, 9, true);
CMenuItem m1(false, "()", "One", 2, 2, 7);
CMenuItem m2(true, "()", "Two", 3, 2, 7);
CMenuItem m3(false, "()", "Three", 4, 2, 7);
CMenuItem* m[3]={&m1, &m2, &m3};
Screen<< new CLabel("Esc: EXIT, Enter/Space: s F6: move,", 0, 0);
int i = 0;
for(int k=1;k<console.getRows();k+=2){
for(int m=0;m<console.getCols()-10;m+=10){
Screen<<new CLabel((i=!i)?"Hello": "Hi",k, m, 9);
}
}
Screen.draw();
FD<<m1<<m2<<m3<<new CLabel(5,2, 20);
FD.draw();
while(!done){
key = FD.edit();
switch(key){
case ESCAPE:
done = true;
break;
case F(6):
FD.move();
break;
case ENTER:
case SPACE:
for(int i=0;i<3;i++){
if(&FD.curField() == m[i]){
si[16] = '0' + i;
FD[3].set(si);
}
else{
m[i]->selected(false);
}
}
break;
}
}
return 0;
}
示例7: main
int main() {
int insert = 1;
int key;
bool done = false;
int i = 0;
CDialog Screen;
CDialog FD(&Screen,5, 5, 35, 9, true);
CCheckMark chb(true,"[X]","Check Box", 3,3, 13);
CCheckMark* chbptr; //Un-commnent line 37 and comment line 36 for alternative way of accessing the checkbox's falg
Screen<< new CLabel("Esc: EXIT, F2: Reset Data, F6: move,", 0, 0);
for(int k=1;k<console.getRows();k+=2){
for(int m=0;m<console.getCols()-10;m+=10){
Screen<<new CLabel((i=!i)?"Hello": "Hi",k, m, 9);
}
}
Screen.draw();
FD<<chb
<<new CLabel("Checked",3, 17, 15)
<<new CCheckMark(false,"(O)","Radio Button", 5, 3,16, true)
<<new CLabel("Not Checked", 5, 20, 13);
FD.draw();
chbptr = (CCheckMark*)&FD[2];
while(!done){
FD[1].set(chb.checked()?"Checked": "Not Checked");
FD[3].set(bool(*((bool*)FD[2].data()))?"Checked": "Not Checked");
// FD[3].set(chbptr->checked()?"Checked": "Not Checked");
key = FD.edit();
switch(key){
case ESCAPE:
done = true;
break;
case F(6):
FD.move();
break;
case F(2):
chb.checked(false);
chbptr->checked(false);
FD.draw();
break;
}
}
return 0;
}
示例8: guiLoadBook
void guiLoadBook(Book b){
if (BookProcessor::isDummyBook(b)){
_oriBook = BookProcessor::getDummyBook();
txtName.set("EMPTY");
txtAuthor.set("EMPTY");
txtPublisher.set("EMPTY");
txtRDate.set("EMPTY");
txtISBN.set("0");
txtRating.set("0");
}
else{
_oriBook = b;
txtName.set(b.name);
txtAuthor.set(b.author);
txtPublisher.set(b.publisher);
txtRDate.set(b.releaseDate);
char tmp[11] = "";
ulongToStr(b.isbn, tmp);
txtISBN.set(tmp);
ulongToStr(b.rating, tmp);
txtRating.set(tmp);
}
scrBook.draw();
}
示例9: main
int main() {
bool insert = true;
int key;
int i = 1;
bool done = false;
char str[100];
CDialog Screen;
CDialog FM(&Screen,2, 5, 60, 20, true);
int fn = 0;
Screen<< new CLabel("F1: HELP ", 0, 0);
for(int k=1;k<console.getRows();k+=2){
for(int m=0;m<console.getCols()-10;m+=10){
Screen<<new CLabel((i=!i)?"Hello": "Hi",k, m, 9);
}
}
Screen.draw();
CMenu menu("Options", "<>", 4, 4, 15, 6, false);
CLabel Mes(13,2,55);
menu.add("Go Back");
menu.add("Option One");
menu.add("Second Option");
menu.add("Option Three", CMenu::Select);
menu.add("The Fourth Option");
menu.add("And The Fifth");
menu.add("The sixth");
menu.add("And finally The seventh");
CMenu AppMenu1("File", "[]", 0, 1, 15, 6, true);
AppMenu1<<"Load"<<"Save"<<"Help"<<CMenu::Select<<"Quit";
CMenu AppMenu2("Edit", "[]", 0, 7, 20, 8, true);
AppMenu2<<"Some option here"<<"Another one here"<<"And yet one more here"<<"How about another one here"<<"Any More left?"<<"Just One more"<<"and yet another"<<"Finaly the last";
FM<<new CLabel("Name:", 2, 2)
<<new CLineEdit(1, 10, 22, 40, &insert,true)
<<menu<<Mes
<<new CLabel("Phone Number:", 16,2)
<<new CLineEdit(15, 16, 15, 12, &insert,true);
int ixAppMenu1 = FM.add(AppMenu1);
int ixAppMenu2 = FM.add(AppMenu2);
FM.draw();
while(!done){
key = FM.edit(fn);
switch(key){
case F(1):
fn = ShowHelp(FM);
break;
case F(2):
fn = ixAppMenu1 + 1;
break;
case F(3):
fn = ixAppMenu2 + 1;
break;
case ESCAPE:
case F(10):
if(Quit(FM)){
done = 1;
}
break;
case SPACE:
fn = FM.curIndex() + 1;
if(&FM.curField() == &menu){ // menu active
if(menu.selectedIndex() == 0){// go back
fn = FM.curIndex();
}
sprintf_s(str,"Sel Idx: %d, Text: %s", menu.selectedIndex(), menu.selectedText());
Mes.set(str);
Mes.draw();
}
if(&FM.curField() == &AppMenu1){ // AppMenu1 active
switch(AppMenu1.selectedIndex()){
case 2: // help
ShowHelp(FM);
break;
case 3: // quit
if(Quit(FM)){
done = 1;
}
break;
}
}
break;
case F(6):
FM.move();
break;
}
}
return 0;
}
示例10: test_6_Check
int test_6_Check() {
int insert = 1;
int key;
bool done = false;
int i = 0;
CDialog Screen;
for(int k=3;k<console.getRows();k+=2){
for(int m=0;m<console.getCols()-10;m+=10){
Screen<<new CLabel((i=!i)?"Hello": "Hi",k, m, 9);
}
}
Screen<<new CLabel(">>>>>> Dialog and CheckMark Tester <<<<<<<<", 0, (console.getCols()-44)/2);
Screen<< new CLabel("Esc: EXIT, F2: Reset Data, F6: move,", 1, 0);
Screen.draw();
CDialog FD(&Screen, 5, 5, 35, 13, true);
CCheckMark chb(true,"[X]","Check Box", 3,3, 13);
CCheckMark* chbptr; // see comment below
CCheckMark* chbptr1;
CCheckMark* chbptr2;
FD<<chb
<<new CLabel("Checked",3, 17, 15)
<<new CCheckMark(false,"(O)","Radio Button", 5, 3,16, true)
<<new CLabel("Not Checked", 5, 20, 13)
<<new CCheckMark(true,"(O)","Radio Button", 7, 3,16, true)
<<new CLabel("Checked", 7, 20, 13)
<<new CCheckMark(false,"(O)","Radio Button", 9, 3,16, true)
<<new CLabel("Not Checked", 9, 20, 13);
FD.draw();
chbptr = (CCheckMark*)&FD[2];
chbptr1 = (CCheckMark*)&FD[4];
chbptr2 = (CCheckMark*)&FD[6];
int which = 0;
while(!done){
FD[1].set(chb.checked()?"Checked": "Not Checked");
//comment next and un-comment the line after for alternative
//way of accessing the checkbox's flag
FD[3].set(bool(*((bool*)FD[2].data()))?"Checked": "Not Checked");
//FD[3].set(chbptr->checked()?"Checked": "Not Checked");
FD[5].set(bool(*((bool*)FD[4].data()))?"Checked": "Not Checked");
FD[7].set(bool(*((bool*)FD[6].data()))?"Checked": "Not Checked");
FD.draw();
key = FD[which].edit();
if ( (key == SPACE && ( *chbptr && chbptr1->checked() )) || ( chbptr->checked() && chbptr2->checked() ) || ( chbptr2->checked() && chbptr1->checked() ) ) {
chbptr->checked(false);
chbptr1->checked(false);
chbptr2->checked(false);
if ( which == 2 )
chbptr->checked(true);
else if ( which == 4 )
chbptr1->checked(true);
else if ( which == 6 )
chbptr2->checked(true);
}
switch(key){
case ESCAPE:
done = true;
break;
case F(6):
FD.move();
break;
case F(2):
chb.checked(false);
chbptr->checked(false);
FD.draw();
break;
case UP:
if ( which == 2 )
which = 0;
else if ( which == 4 )
which = 2;
else if ( which == 6 )
which = 4;
break;
case DOWN:
if ( which == 0 )
which = 2;
else if ( which == 2 )
which = 4;
else if ( which == 4 )
which = 6;
break;
}
}
return 0;
}