Skript für Textfelder mit fester GrößeHallo,
Ich muss ein Fenster generieren, in dem der obere Text beox immer eine feste Höhe hat, wobei ein anderes Textfeld darunter eine andere feste Höhe usw. hat. Auf diese Weise werden 5 verschiedene Textfelder gestapelt. Wenn das Fenster angezeigt wird, befinden sich die Textfelder unabhängig von der Änderung des Texts immer an derselben Position.
Jede Hilfe sehr geschätzt.
Hier ist mein momentan nicht erfolgreicher Code:
VALconv = 37.795275591;
VALwidth = 6*VALconv;
tb1 = Text Box(STRname);
tb1 << Set Font("Lucida Handwriting",18,"bold");
tb1 << Set Max Size(VALwidth,1.8*VALconv);
tb1 << Set Width(VALwidth);
tb1 << Set Height(1.8*VALconv);
tb1 << Set Wrap(VALwidth);
hb1 = H List Box(tb1);
hb1 << Set Max Size(VALwidth,1.8*VALconv);
hb1 << Set Min Size(VALwidth,1.8*VALconv);
tb2 = Text Box(STRch1);
tb2 << Set Font("Arial",12);
tb2 << Set Max Size(VALwidth,2*VALconv);
tb2 << Set Width(VALwidth);
tb2 << Set Height(2*VALconv);
tb2 << Set Wrap(VALwidth);
hb2 = H List Box(tb2);
hb2 << Set Max Size(VALwidth,2*VALconv);
hb2 << Set Min Size(VALwidth,2*VALconv);
tb3 = Text Box(STRch2);
tb3 << Set Font("Arial",12);
tb3 << Set Max Size(VALwidth,2*VALconv);
tb3 << Set Width(VALwidth);
tb3 << Set Height(2*VALconv);
tb3 << Set Wrap(VALwidth);
hb3 = H List Box(tb3);
hb3 << Set Max Size(VALwidth,2*VALconv);
hb3 << Set Min Size(VALwidth,2*VALconv);
tb4 = Text Box(STRch3);
tb4 << Set Font("Arial",12);
tb4 << Set Max Size(VALwidth,2*VALconv);
tb4 << Set Width(VALwidth);
tb4 << Set Height(2*VALconv);
tb4 << Set Wrap(VALwidth);
hb4 = H List Box(tb4);
hb4 << Set Max Size(VALwidth,2*VALconv);
hb4 << Set Min Size(VALwidth,2*VALconv);
tb5 = Text Box(STRtype);
tb5 << Set Font("Arial",12);
tb5 << Set Max Size(VALwidth,1*VALconv);
tb5 << Set Width(VALwidth);
tb5 << Set Height(1*VALconv);
tb5 << Set Wrap(VALwidth);
hb5 = H List Box(tb5);
hb5 << Set Max Size(VALwidth,1*VALconv);
hb5 << Set Min Size(VALwidth,2*VALconv);
NW = New Window("NW", hb1,hb2,hb3,hb4,hb5);<BR />
Betreff: Skript, um Textfelder mit fester Größe zu habenIch verstehe nicht, warum dieser Code nicht erfolgreich ist. Bitte erläutern Sie, wie die Ausgabe aussehen soll. Übrigens brauchen Sie nicht alle H-Listenfelder, da Sie nichts horizontal neben den Textfeldern platzieren. Wenn Sie Bedenken haben, dass die Breite gleich ist, können Sie LINEUP BOX verwenden.

strname = "Hello World";
strch1 = "Fubarski";
strch2 = strch1;
strch3 = strch1;
strtype = "String Type";
VALconv = 37.795275591;
VALwidth = 6*VALconv;
tb1 = Text Box(STRname);
tb1 << Set Font("Lucida Handwriting",18,"bold") << Set Max Size(VALwidth,1.8*VALconv);
tb1 << Set Width(VALwidth) << Set Height(1.8*VALconv) << Set Wrap(VALwidth);
tb2 = Text Box(STRch1);
tb2 << Set Font("Arial",12) << Set Max Size(VALwidth,2*VALconv);
tb2 << Set Width(VALwidth) << Set Height(2*VALconv) << Set Wrap(VALwidth);
tb3 = Text Box(STRch2);
tb3 << Set Font("Arial",12) << Set Max Size(VALwidth,2*VALconv);
tb3 << Set Width(VALwidth) << Set Height(2*VALconv) << Set Wrap(VALwidth);
tb4 = Text Box(STRch3);
tb4 << Set Font("Arial",12) << Set Max Size(VALwidth,2*VALconv);
tb4 << Set Width(VALwidth) << Set Height(2*VALconv) << Set Wrap(VALwidth);
tb5 = Text Box(STRtype);
tb5 << Set Font("Arial",12) << Set Max Size(VALwidth,1*VALconv);
tb5 << Set Width(VALwidth) << Set Height(1*VALconv) << Set Wrap(VALwidth);
NW = New Window("NW", lineup box(ncol(1), tb1,tb2,tb3,tb4,tb5));Betreff: Skript, um Textfelder mit fester Größe zu habenWenn Sie möchten, dass alle Textfelder dieselbe Höhe haben, können Sie ein zweizeiliges Textfeld (zwei LFs) neben jedes der Textfelder stellen. Versuche dies:
strname = "Hello World";
strch1 = "Fubarski";
strch2 = strch1;
strch3 = strch1;
strtype = "String Type";
VALconv = 37.795275591;
VALwidth = 6*VALconv;
tb1 = Text Box(STRname);
tb1 << Set Font("Lucida Handwriting",18,"bold") << Set Max Size(VALwidth,1.8*VALconv);
tb1 << Set Width(VALwidth) << Set Height(1.8*VALconv) << Set Wrap(VALwidth);
tb2 = Text Box(STRch1);
tb2 << Set Font("Arial",12) << Set Max Size(VALwidth,2*VALconv);
tb2 << Set Width(VALwidth) << Set Height(2*VALconv) << Set Wrap(VALwidth);
tb3 = Text Box(STRch2);
tb3 << Set Font("Arial",12) << Set Max Size(VALwidth,2*VALconv);
tb3 << Set Width(VALwidth) << Set Height(2*VALconv) << Set Wrap(VALwidth);
tb4 = Text Box(STRch3);
tb4 << Set Font("Arial",12) << Set Max Size(VALwidth,2*VALconv);
tb4 << Set Width(VALwidth) << Set Height(2*VALconv) << Set Wrap(VALwidth);
tb5 = Text Box(STRtype);
tb5 << Set Font("Arial",12) << Set Max Size(VALwidth,1*VALconv);
tb5 << Set Width(VALwidth) << Set Height(1*VALconv) << Set Wrap(VALwidth);
tb0 = text box("
");
NW = New Window("NW", lineup box(ncol(2), tb1, tb0, tb2, tb0, tb3, tb0, tb4, tb0, tb5, tb0));Betreff: Skript, um Textfelder mit fester Größe zu habenEntschuldigung, ich hätte genauer und weniger vage sein sollen.
Ich versuche immer das genaue Layout wie in diesem Bild zu erhalten, mit dem erforderlichen "Leerraum", so dass Text 2 immer 1,8 cm nach unten beginnt, wenn Text 1 kurz ist usw.
VALconv ist, wie ich glaube, das Pixel-zu-cm-Konvertierungsverhältnis von einem schnellen Google.
Anfangs waren es H-Listenfelder, da ich in einer zukünftigen Iteration vielleicht Text und Bilder in einem "Feld" mischen möchte, das eine feste Größe hat (z. B. 1,8 cm mal 6 cm), aber das ist ein Wunsch, den man nicht haben muss, und Mein Hauptziel ist, dass es zuerst mit Klartext funktioniert.
Betreff: Skript, um Textfelder mit fester Größe zu habenFür TextBox ist eine Meldung mit fester Größe verfügbar. Vielleicht würde etwas wie das Folgende für Sie funktionieren. Hinweis: Ich habe BorderBoxes hinzugefügt, damit Sie die Größe der TextBoxes besser erkennen können.
strname = "Text1";
strch1 = "Text2";
strch2 = "Text3";
strch3 = "Text4";
strtype = "Text5";
VALconv = 37.795275591;
VALwidth = 6 * VALconv;
tb1 = Text Box( STRname );
tb1 << Set Font( "Lucida Handwriting", 18, "bold" ) << Fixed Size( 1, VALwidth, 1.8 * VALconv );
tb2 = Text Box( STRch1 );
tb2 << Set Font( "Arial", 12 ) << Fixed Size( 1, VALwidth, 2 * VALconv );
tb3 = Text Box( STRch2 );
tb3 << Set Font( "Arial", 12 ) << Fixed Size( 1, VALwidth, 2 * VALconv );
tb4 = Text Box( STRch3 );
tb4 << Set Font( "Arial", 12 ) << Fixed Size( 1, VALwidth, 2 * VALconv );
tb5 = Text Box( STRtype );
tb5 << Set Font( "Arial", 12 ) << Fixed Size( 1, VALwidth, 1 * VALconv );
NW = New Window( "NW",
Lineup Box( N Col( 1 ),
Border Box( Left( 0 ), Right( 0 ), Top( 0 ), Bottom( 0 ), Sides( 15 ), tb1 ),
Border Box( Left( 0 ), Right( 0 ), Top( 0 ), Bottom( 0 ), Sides( 15 ), tb2 ),
Border Box( Left( 0 ), Right( 0 ), Top( 0 ), Bottom( 0 ), Sides( 15 ), tb3 ),
Border Box( Left( 0 ), Right( 0 ), Top( 0 ), Bottom( 0 ), Sides( 15 ), tb4 ),
Border Box( Left( 0 ), Right( 0 ), Top( 0 ), Bottom( 0 ), Sides( 15 ), tb5 )
)
);
Ich hoffe das hilft!
Betreff: Skript, um Textfelder mit fester Größe zu habenWas abbauen @ Wendy_Murphrey sagte. Ich werde manchmal Funktionen dazu bringen, vordefinierte Objekte als gefälschte Methode zur Unterklasse zurückzugeben.
Names Default to Here( 1 );
strname = "Text1";
strch1 = "Text2";
strch2 = "Text3";
strch3 = "Text4";
strtype = "Text5";
Lucida_Textbox = function({text},
{DEFAULT LOCAL},
VALconv = 37.795275591;
VALwidth = 6 * VALconv;
tb = Text Box( text );
tb << Set Font( "Lucida Handwriting", 18, "bold" ) << Fixed Size( 1, VALwidth, 1.8 * VALconv );
return(tb);
);
Arial_Textbox = function({text},
{DEFAULT LOCAL},
VALconv = 37.795275591;
VALwidth = 6 * VALconv;
tb = Text Box( text );
tb << Set Font( "Arial", 12 ) << Fixed Size( 1, VALwidth, 2 * VALconv );
return(tb);
);
tb1 = Lucida_Textbox( STRname );
tb2 = Arial_Textbox( STRch1 );
tb3 = Arial_Textbox( STRch2 );
tb4 = Arial_Textbox( STRch3 );
tb5 = Arial_Textbox( STRtype );
NW = New Window( "NW",
Lineup Box( N Col( 1 ),
Border Box( Left( 0 ), Right( 0 ), Top( 0 ), Bottom( 0 ), Sides( 15 ), tb1 ),
Border Box( Left( 0 ), Right( 0 ), Top( 0 ), Bottom( 0 ), Sides( 15 ), tb2 ),
Border Box( Left( 0 ), Right( 0 ), Top( 0 ), Bottom( 0 ), Sides( 15 ), tb3 ),
Border Box( Left( 0 ), Right( 0 ), Top( 0 ), Bottom( 0 ), Sides( 15 ), tb4 ),
Border Box( Left( 0 ), Right( 0 ), Top( 0 ), Bottom( 0 ), Sides( 15 ), tb5 )
)
);