📄 ex-dialogs.ulp
字号:
dlgRadioButton("&Center", align);
dlgRadioButton("&Bottom", align);
dlgPushButton("+OK") dlgAccept();
dlgPushButton("-Cancel") dlgReject();
}
};
if (Result == 0) exit (0);
// Input a real value
real rValue = 33.333;
Result = dlgDialog("RealEdit"){
dlgHBoxLayout {
dlgLabel("Enter a &Number between 0.0 and 99.0");
dlgRealEdit(rValue, 0.0, 99.0);
dlgVBoxLayout {
dlgHBoxLayout {
dlgStretch(1);
dlgPushButton("+OK") dlgAccept();
dlgStretch(0);
}
dlgHBoxLayout {
dlgStretch(1);
dlgPushButton("-Cancel") dlgReject();
dlgStretch(0);
}
}
}
};
if (Result == 0) exit (0);
sprintf(st, "%f", rValue);
dlgMessageBox("last real value = " + st);
// Define additional space in a box layout context
// space is given in pixels
Result = dlgDialog("Spacing V-Box"){
dlgVBoxLayout {
dlgLabel("Label V1");
dlgSpacing(70);
dlgLabel("Label V2");
}
};
if (Result == 0) exit (0);
Result = dlgDialog("Spacing HBox"){
dlgHBoxLayout {
dlgLabel("Label H1");
dlgSpacing(100);
dlgLabel("Label H2");
}
};
if (Result == 0) exit (0);
// Select two values
Result = dlgDialog("Spinbox - select value for X and Y") {
dlgVBoxLayout {
dlgLabel("select &X"); // character & mark selected by ALT+Key
dlgSpinBox(Value, 0, 99);
dlgLabel("select &Y");
dlgSpinBox(Wert, -99, 99);
dlgPushButton("+OK") dlgAccept();
// + is the Default-Button [ENTER]
dlgPushButton("-throw away") dlgReject();
// - is the Cancel-Button [ESC]
};
};
if (Result == 0) exit (0);
dlgMessageBox("ATTENTION:\ndrag the next menu border line!", "OK");
// Define an empty stretchable space in a box layout context
Result = dlgDialog("Stretch horizontal") {
dlgHBoxLayout {
dlgStretch(0);
dlgPushButton("+OK") dlgAccept();
dlgStretch(5);
dlgPushButton("Key B");
dlgStretch(15);
dlgPushButton("Key C");
dlgStretch(40);
dlgPushButton("-Cancel") dlgReject();
dlgStretch(5);
}
};
if (Result == 0) exit (0);
dlgMessageBox(" ATTENTION:\ndrag the next menu border line!", "OK");
Result = dlgDialog("Stretch vertical") {
dlgVBoxLayout {
dlgStretch(0);
dlgPushButton("+OK") dlgAccept();
dlgStretch(5);
dlgPushButton("Key 2");
dlgStretch(15);
dlgPushButton("Key 3");
dlgStretch(40);
dlgPushButton("-Cancel") dlgReject();
dlgStretch(0);
}
};
if (Result == 0) exit (0);
// Defines a string entry field
// define fixed length by dlgSpacing
string Name = "Linus Torvalds";
Result = dlgDialog("dlgStringEdit") {
dlgHBoxLayout dlgSpacing(400);
dlgStretch(0);
dlgLabel("Enter &Name");
dlgStretch(0);
dlgStringEdit(Name);
dlgVBoxLayout {
dlgStretch(0);
dlgHBoxLayout {
dlgStretch(1);
dlgPushButton("+OK") dlgAccept();
dlgStretch(0);
}
dlgHBoxLayout {
dlgStretch(1);
dlgPushButton("-Cancel") dlgReject();
dlgStretch(0);
}
dlgStretch(10);
};
dlgStretch(1);
};
if (Result == 0) exit (0);
dlgMessageBox("the last selected \n" + Name);
// Define a tab page
align = 0;
int p_align = 0;
Result = dlgDialog("Container for tab pages") {
//Define a container for tab pages
dlgTabWidget {
dlgTabPage("&Video") {
dlgHBoxLayout {
dlgLabel("<img src=eagle.bmp>");
}
dlgHBoxLayout {
dlgLabel("Video mode");
dlgGroup("Gruppe") {
dlgRadioButton("&Black and White", align);
dlgRadioButton("&White and Black", align);
}
}
}
dlgTabPage("&Printer") {
dlgLabel("Printer setup");
dlgGroup("Gruppe") {
dlgRadioButton("&Top", p_align);
dlgRadioButton("&Center", p_align);
dlgRadioButton("&Bottom", p_align);
}
}
dlgTabPage("&Memory") {
dlgLabel("Memory setup");
dlgCheckBox("R&otate", rotate);
dlgCheckBox("Mi&rror", mirror);
dlgCheckBox("&Flip", flip);
dlgCheckBox("&Swap", swap);
}
dlgTabPage("&Export") {
dlgLabel("select a file name for WRITE");
dlgHBoxLayout {
dlgStretch(0);
dlgPushButton("&File") {
string fileName;
fileName = dlgFileOpen("select a File", "*.*", "*.BRD\n*.SCH\n*.SCH\n*.ULP");
};
dlgStretch(1);
}
}
dlgTabPage("&Input") {
dlgLabel("select a file for read");
dlgHBoxLayout {
dlgStretch(0);
dlgPushButton("&File") {
string fileName;
fileName = dlgFileOpen("select a File", "*.*", "");
};
dlgStretch(1);
}
}
dlgTabPage("&Help") {
dlgLabel("<img src=eagle.bmp>");
dlgLabel("Copyright (c) 1988-2000 CadSoft Computer GmbH");
}
}
dlgHBoxLayout {
dlgStretch(0);
dlgPushButton("+OK") dlgAccept();
dlgStretch(0);
dlgLabel(" <--------> ");
dlgStretch(0);
dlgPushButton("-Cancel") dlgReject();
dlgStretch(1);
}
};
if (Result == 0) exit (0);
string sresult;
sprintf(sresult, "%d", Value);
cmd = "selected X = " + sresult + ".\n";
sprintf(sresult, "%d", Wert);
cmd += "selected Y = " + sresult + ".\n";
Result = dlgDialog("Editor Window") {
dlgTextEdit(cmd);
dlgHBoxLayout {
dlgPushButton("+OK") dlgAccept();
dlgPushButton("-Cancel") dlgReject();
}
};
if (Result == 0) exit (0);
dlgMessageBox(cmd);
//Define a multiline text viewer field
Text = "This is some text.\nLine 2\nLine 3";
string Text2 = "This is the 2nd text.\nLine 2\nLine 3";
Text2 += "\n...\n...\n...\n...\nScroll-\nbars\non?\n";
Text2 += "OK\nEnd.";
Result = dlgDialog("List Window") {
dlgVBoxLayout {
dlgLabel("&View the text");
dlgTextView(Text);
dlgLabel("Vie&w the text");
dlgTextView(Text2);
}
dlgHBoxLayout {
dlgStretch(1);
dlgPushButton("+OK") dlgAccept();
}
};
if (Result == 0) exit (0);
// Button
int haveButton = 1;
Result = dlgDialog("Test") {
dlgLabel("Start");
if (haveButton)
dlgPushButton("Here") dlgAccept();
};
if (Result == 0) exit (0);
Result = dlgDialog("'3 Boxes close by ESC") {
dlgHBoxLayout {
dlgLabel("Box 1");
dlgLabel("Box 2");
dlgLabel("Box 3");
dlgPushButton("+OK") dlgAccept();
}
};
if (Result == 0) exit (0);
Result = dlgDialog("selected Color") {
dlgVBoxLayout {
dlgLabel("selected Color");
dlgLabel(Colors[Selected]);
}
};
if (Result == 0) exit (0);
// Redisplays the dialog after changing values
string Status[] = { "Idle", "1st run", "2nd run", "3rd run", "Finished" } ;
int stat = 0;
string labstr = Status[0];
Result = dlgDialog("Test") {
dlgLabel(labstr);
dlgPushButton("+OK") dlgAccept(42);
dlgPushButton("Cancel") dlgReject(-3);
dlgPushButton("Run") {
if (stat < 4) stat++;
labstr = Status[stat];
dlgRedisplay();
// some program action here...
}
dlgPushButton("Reset") {
dlgReset();
stat = 0;
labstr = Status[stat];
dlgRedisplay();
}
};
if (Result == 0) exit (0);
sprintf(cmd, "%d", Result);
dlgMessageBox(cmd);
int Number = 99;
string dlgStr = "Empty";
real rVal = 9.99;
Result = dlgDialog("Reset Int & Real to 0") {
dlgIntEdit(Number);
dlgRealEdit(rVal);
dlgStringEdit(dlgStr);
dlgPushButton("+OK") dlgAccept(42);
dlgPushButton("Cancel") dlgReject();
dlgPushButton("Reset") dlgReset();
};
if (Result == 0) exit (0);
// File handling
int n = 0;
char b[];
string fileName = dlgFileOpen("select File", "*.*", "*.BRD\n*.SCH\n*.SCH\n*.ULP");
int nBytes = fileread(b, fileName);
for (int x = 0; x < nBytes; x++) {
cmd += b[x];
}
dlgMessageBox(fileName +"\nread", "OK");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -