64 #include <TGToolBar.h>
65 #include <TGStatusBar.h>
67 #include <TVirtualX.h>
69 #include <TInterpreter.h>
72 #include <RQ_OBJECT.h>
74 #include <TGTextEntry.h>
120 void Print(Option_t* opt=
"")
const;
121 void Entered(
const Text_t* dsn=0,
123 const Text_t* usr=0 );
136 fMain =
new TGMainFrame(gClient->GetRoot(),500,200);
137 fMain->SetWMSizeHints(500,200,500,200,0,0);
138 fMain->SetWindowName(
"Enter DSN, Password, User Name");
139 fMain->SetIconName(
"Enter DSN, Password ,User Name");
162 fPswdEntry->SetEchoMode(TGTextEntry::kPassword);
168 "Type DSN, Username and Password to log on");
180 fMain->MapSubwindows();
182 fMain->SetWMPosition(300,300);
183 fMain->ChangeOptions(
fMain->GetOptions() | kFixedSize);
187 fDSNEntry->Connect(
"ReturnPressed()",
"PasswordDialog",
194 fUserEntry->Connect(
"ReturnPressed()",
"PasswordDialog",
195 this,
"UsernameEntered");
201 fPswdEntry->Connect(
"ReturnPressed()",
"PasswordDialog",
202 this,
"PasswordEntered()");
210 fOKButton->Connect(
"Released()",
"PasswordDialog",
211 this,
"PasswordEntered()");
232 fMain->UnmapWindow();
274 if( !DSN.IsNull() && !USR.IsNull() ) {
278 args[0] = (long)DSN.Data();
279 args[1] = (long)USR.Data();
280 args[2] = (long)PWD.Data();
286 Emit(
"Entered(Text_t*,Text_t*,Text_t*)",args);
327 Entered(dsn.Data(),usr.Data(),pwd.Data());
360 const TString&
value,
const TString&
name);
372 const TString&
value,
const TString&
name)
376 fMain =
new TGCompositeFrame(p,32, 32,kHorizontalFrame);
377 fLayoutHints1 =
new TGLayoutHints( kLHintsRight | kLHintsExpandX,
388 fEntry->SetEnabled(kFALSE);
392 fEntry->Connect(
"ReturnPressed()",
"DbFormEntry",
this,
393 "Updated(Int_t,Text_t*)");
419 TString newValue =
fEntry->GetText();
423 args[1] = (long)newValue.Data();
424 Emit(
"Updated(Int_t,Text_t*)",args);
509 void Connect(
const Text_t* dsn,
const Text_t*
uid,
const Text_t* pwd);
519 TGLayoutHints *lo = 0;
527 if(gForm) gInterpreter->DeleteGlobal(gForm);
529 fMain =
new TGMainFrame(gClient->GetRoot(),500,500);
530 fMain->SetWMSizeHints(500,500,500,500,0,0);
531 fMain->SetWindowName(
"Simple Database Form");
532 fMain->SetIconName(
"Simple of Database Form");
533 fMain->SetClassHints(
"DbForm",
"DbForm");
534 fMain->SetMWMHints(kMWMDecorAll, kMWMFuncAll, kMWMInputModeless);
536 fFileMenu =
new TGPopupMenu(gClient->GetRoot());
542 fGotoMenu =
new TGPopupMenu(gClient->GetRoot());
548 fHelpMenu =
new TGPopupMenu(gClient->GetRoot());
553 kLHintsExpandX,5,5,3,1);
556 kLHintsLeft,0,20,3,1);
559 kLHintsRight,0,5,3,1);
568 fBarLayout =
new TGLayoutHints(kLHintsTop | kLHintsExpandX);
584 int parts[] = { 25, 75 };
586 lo =
new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 0, 0, 3, 0);
602 lo =
new TGLayoutHints( kLHintsBottom |
604 kLHintsExpandY, 3, 3, 3, 3);
613 fMain->MapSubwindows();
614 fMain->SetWMPosition(300,300);
625 fFileMenu->Connect(
"Activated(Int_t)",
"DbForm",
this,
626 "HandleFileMenu(Int_t)");
628 fGotoMenu->Connect(
"Activated(Int_t)",
"DbForm",
this,
629 "HandleGotoMenu(Int_t)");
632 "HandleExecuteQuery()");
635 "HandleExecuteQuery()");
640 fFirstButton->Connect(
"Released()",
"DbForm",
this,
"First()");
641 fLastButton->Connect(
"Released()",
"DbForm",
this,
"Last()");
648 fNextButtonTimer->Connect(
"Timeout()",
"DbForm",
this,
"AccelerateNextButton()");
654 fPrevButtonTimer->Connect(
"Timeout()",
"DbForm",
this,
"AcceleratePrevButton()");
768 sprintf(rowstr,
"Row: %d",row);
793 for(
int i=1;
i <= ncollumns; ++
i ) {
814 fPD->Connect(
"Entered(Text_t*,Text_t*,Text_t*)",
816 "Connect(Text_t*,Text_t*,Text_t*)");
864 TGCompositeFrame* cont = (TGCompositeFrame*)
fCanvasWindow->GetContainer();
865 TList* list = cont->GetList();
868 for(
int i=1;
i <= ncollumns; ++
i ) {
873 cont->MapSubwindows();
887 if(sql.IsNull())
return;
913 sprintf(rowstr,
"Row: %d",row);
921 for(
int i=1;
i <= ncollumns; ++
i ) {
933 fMain->MapSubwindows();
936 sql =
"Failed to execute " + sql;
989 TString info =
"Connected to DSN - ";
1050 EMsgBoxIcon icontype = kMBIconExclamation;
1058 errb =
new TGMsgBox(gClient->GetRoot(),gForm->
GetMainFrame(),
1059 "Error", str.Data(),icontype, buttons, &retval);
1061 printf(
"%s\n",str.Data());
1075 #include <TApplication.h>
1076 #include <TSystem.h>
1077 #include <TInterpreter.h>
1081 TROOT
root(
"RDBCform",
"GUI form for table browsing");
1083 int main(
int argc,
char **argv)
1085 TApplication theApp(
"App", &argc, argv);
1087 if (gROOT->IsBatch()) {
1088 fprintf(stderr,
"%s: cannot run in batch mode\n", argv[0]);
1092 gSystem->Load(
"libRDBC");
1093 gSystem->Load(
"./RDBCform_C");
1094 gInterpreter->ProcessLine(
"gForm = new DbForm();");