ich habe mal wieder eine Frage. Ich programmiere gerade an einem Win 10 Rechner. Die Größe ist an dem 24 Zoll Bildschirm angepasst. Ich habe das Programm im Endwicklungsmodus und als Sandalone Version, auf meinen Laptop laufen lassen. Dieser ist auch Win 10, hat aber einen kleineren Bildschirm.
Es ist also nicht alles drauf. Wie kann ich das anpassen?
Ich habe nur eine Idee, die leider nicht funktioniert. Ich habe ein kleines Dropdowm Menü mit verschiedenen
anwählbaren Größen und folgendes Skript zum aktivieren, bzw. auswählen.
on mouseDown
if the label of me is "640x480" then
set the width of card "kosten" to "640"
set the height of card "kosten" to "480"
end if
end mouseDown
Die folgende Fehlermeldung kommt als Laufzeitfehler:
button "zoll": execution error at line n/a (Object: can't set this property)
CARDS haben diese Property (height/width) eben nicht, sondern nur der Stack! :-)
Stackgröße = Kartengröße, also so klappts dann:
on mouseDown
if the label of me is "640x480" then
## Zahlen benötigen keine Gänsefüßchen!
set the width of THIS STACK to 640
set the height of THIS STACK to 480
end if
end mouseDown
Falls Dein Dropdownmenü noch weitere "menutitems" enthalten soll, empfehle ich,
die "on menupick" Message zu skripten.
danke für die Hilfe
Die Größe ändert er mit deinem Skript aber.....
1.Leider reagiert er bei on mousepick nicht.
Es kommt keine Fehlermeldung, es passiert aber auch nichts.
Mit on mouseup ist es zwar umständlich aber geht.
2.Die Verkleinerung funktioniert dann, nur was außerhalb des Bildes ist, ist "weg"
Ich habe gehofft, dass alles auf diesen kleineren Bildschirm "zusammengerafft" wird.
Leider passiert das nicht und man kann auch nicht scrollen.
Wie kann ich das denn bewerkstelligen? Ich wollte eigentlich nur, dass die Größe angepasst wird. Wenn nicht automatisch, dann wenigstens mit dem Button.
1.Leider reagiert er bei on mousepick nicht.
Es kommt keine Fehlermeldung, es passiert aber auch nichts.
Darum schrieb ich ja auch ON MENUpick! 8-)
on menupick the_selected_item
switch the_selected_item
case "640x480"
set the width of THIS STACK to 640
set the height of THIS STACK to 480
break
case "1024x768"
set the width of THIS STACK to 640
set the height of THIS STACK to 480
break
## etc. für weitere Auflösungen
end switch
end menupick
Oder, ganz clever und kurz, wenn Du immer ein x als Trenner für die Größen nimmst:
on menupick the_selected_item
set itemdel to "x"
set the width of THIS STACK to item 1 of the_selected_item
set the height of THIS STACK to item 2 of the_selected_item
end menupick
:-)
Aber leider ändert das wirklich nur die Größe des Stacks!
Alles Weitere (Skalieren/Bewegen der Objekte auf der Karte) obliegt Dir, dem Entwickler!
Gibt es eigentlich eine Liste von Befehlen mit kurzer Erklärung, in Deutsch?
Vieles wie MenuPick setzte ich nicht ein, weil ich es nicht kenne.
Nee, soweit ich weiß nicht...
Aber hier gibt es ein paar Stack, um die "Basics" von LC kennenzulernen: Online Scripting Conferences
Ist allerdings in Englisch.
Aber Du darfst mich gerne alles Fragen! :-D
Dein Skript ist sehr gut aber das Problem beleibt natürlich.
Blöd, weil ich im Moment keine Idee habe wie ich das lösen kann.
Ich habe so etwas früher schon einmal gemacht, ist aber aufwendig und viel Handarbeit.
Wenn ich Die Zeit finde, schreibe ich mal, wie ich es gemacht habe.
Im Prinzip habe ich zunächst das "größte" Layout genommen und das RECT jedes Objektes auf der Karte in einer Custom Property dieses Objektes gespeichert.
Dann das kleinere Layout manuell entsprechend angepasst -> Größe und Posititon der Objekte und dann wieder diese neuen RECTS der Objekte wie oben abgespeichert.
Dann kann man diese Werte wieder zuordnen und somit das komplette Layout ändern.
Soweit klar, zumindest im Prinzip?
Dein Prinzip ist mir grundsätzlich auch klar. Ich hatte schon viel Arbeit befürchtet.
Wenn du das Skript mal schickst wäre ich sehr dankbar.
Solange versuche ich mal mein Glück.
Ich werde über Ostern mal einen kleinen Stack zusammenzimmern! :-)
Auf meiner Website habe ich auch ein paar Beispiele in deutsch.
Sind uralt, die Endung ist noch .mc
Aendere sie um in .rev, dann tauchen sie auch im Oeffnen-Dialog von LC auf. https://major-k.de/xtalk.html
aufgrund von Klaus Vorschlag mit RECT habe ich habe gestern zwei Handler gebaut, die das Problem lösen:
Hier ist der Code, der in das Stack-Skript kopiert wird:
-------------------------------------------------------------------
-- Diese Konstante bestimmt den Namens-Prefix für die
-- Stack-Properties. Dieser Name ist im Prinzip beliebig
-- und kann nach eigenem Ermessen/Geschmack geändert werden.
constant kSizePrefix = "Sizeposition_"
-------------------------------------------------------------------
command save_control_positions
## Ermittlung der aktuellen Größe des Fensters, um den Größenparameter zu setzen
put the width of this stack & "_" & the height of this stack into tActualSize
## Name für die Größen-Property erstellen, z.B. "Sizeposition_800_400"
put kSizePrefix & tActualSize into tSizeProperty
## Speicherung der aktuellen Position und Größe jedes Bedienelements /Control)
repeat with i = 1 to the number of controls of the current card
set the tSizeProperty of control i to the rect of control i
end repeat
end save_control_positions
-------------------------------------------------------------------
command set_control_positions pSize
put kSizePrefix & pSize into tSizeProperty
put the tSizeProperty of control 1 into tNewSize
if tNewSize is empty then
put the customKeys of control 1 into tCustomProperties
filter lines of tCustomProperties with kSizePrefix & "*"
replace kSizePrefix with empty in tCustomProperties
if tCustomProperties is empty then
answer "Keine Auflösungen verfügbar!"
exit set_control_positions
else
put empty into tButtonListe
repeat for each line i in tCustomProperties
put quote & i & quote & " OR " after tButtonListe
end repeat
put "Cancel" after tButtonListe
put "answer " & quote & "Folgende Auflösungen sind verfügbar:" & quote && " with" && tButtonListe into tAuswahl
do tAuswahl
if it is "Cancel" then
exit set_control_positions
else
set_control_positions it
end if
end if
else
put the loc of this stack into tStackLoc
set itemdelimiter to "_"
set the width of this stack to item 1 of pSize
set the height of this stack to item 2 of pSize
set the loc of this stack to tStackLoc
repeat with i = 1 to the number of controls of the current card
set the rect of control i to the tSizeProperty of control i
end repeat
end if
end set_control_positions
-------------------------------------------------------------------
Hier ist der Code, der in das Stack-Skript kopiert wird:
-------------------------------------------------------------------
-- Diese Konstante bestimmt den Namens-Prefix für die
-- Stack-Properties. Dieser Name ist im Prinzip beliebig
-- und kann nach eigenem Ermessen/Geschmack geändert werden.
constant kSizePrefix = "Sizeposition_"
-------------------------------------------------------------------
command save_control_positions
## Ermittlung der aktuellen Größe des Fensters, um den Größenparameter zu setzen
put the width of this stack & "_" & the height of this stack into tActualSize
## Name für die Größen-Property erstellen, z.B. "Sizeposition_800_400"
put kSizePrefix & tActualSize into tSizeProperty
## Speicherung der aktuellen Position und Größe jedes Bedienelements /Control)
repeat with i = 1 to the number of controls of the current card
set the tSizeProperty of control i to the rect of control i
end repeat
end save_control_positions
-------------------------------------------------------------------
command set_control_positions pSize
put kSizePrefix & pSize into tSizeProperty
put the tSizeProperty of control 1 into tNewSize
if tNewSize is empty then
put the customKeys of control 1 into tCustomProperties
filter lines of tCustomProperties with kSizePrefix & "*"
replace kSizePrefix with empty in tCustomProperties
if tCustomProperties is empty then
answer "Keine Auflösungen verfügbar!"
exit set_control_positions
else
put empty into tButtonListe
repeat for each line i in tCustomProperties
put quote & i & quote & " OR " after tButtonListe
end repeat
put "Cancel" after tButtonListe
put "answer " & quote & "Folgende Auflösungen sind verfügbar:" & quote && " with" && tButtonListe into tAuswahl
do tAuswahl
if it is "Cancel" then
exit set_control_positions
else
set_control_positions it
end if
end if
else
put the loc of this stack into tStackLoc
set itemdelimiter to "_"
set the width of this stack to item 1 of pSize
set the height of this stack to item 2 of pSize
set the loc of this stack to tStackLoc
repeat with i = 1 to the number of controls of the current card
set the rect of control i to the tSizeProperty of control i
end repeat
end if
end set_control_positions
-------------------------------------------------------------------
Hab doch glatt vergessen, den Code hier ins Forum zu stellen :-)
Ich benutze den Code übrigens gerade selber, weil ich eine Standalone mache und feststelle, dass diese auf Rechnern laufen muss, die eine kleinere Auflösung als meine Mühle haben. Ich will aber nicht immer mit der kleineren Variante arbeiten müssen. So kann ich bequem zwischen verschiedenenen Auflösungen umschalten.
LG
Torsten
-------------------------------------------------------------------
-- Diese Konstante bestimmt den Namens-Prefix für die
-- Stack-Properties. Dieser Name ist im Prinzip beliebig
-- und kann nach eigenem Ermessen/Geschmack geändert werden.
constant kSizePrefix = "Sizeposition_"
-------------------------------------------------------------------
command save_control_positions
## Ermittlung der aktuellen Größe des Fensters, um den Größenparameter zu setzen
put the width of this stack & "_" & the height of this stack into tActualSize
## Name für die Größen-Property erstellen, z.B. "Sizeposition_800_400"
put kSizePrefix & tActualSize into tSizeProperty
## Speicherung der aktuellen Position und Größe jedes Bedienelements /Control)
repeat with i = 1 to the number of controls of the current card
set the tSizeProperty of control i to the rect of control i
end repeat
end save_control_positions
-------------------------------------------------------------------
command set_control_positions pSize
put kSizePrefix & pSize into tSizeProperty
put the tSizeProperty of control 1 into tNewSize
if tNewSize is empty then
put the customKeys of control 1 into tCustomProperties
filter lines of tCustomProperties with kSizePrefix & "*"
replace kSizePrefix with empty in tCustomProperties
if tCustomProperties is empty then
answer "Keine Auflösungen verfügbar!"
exit set_control_positions
else
put empty into tButtonListe
repeat for each line i in tCustomProperties
put quote & i & quote & " OR " after tButtonListe
end repeat
put "Cancel" after tButtonListe
put "answer " & quote & "Folgende Auflösungen sind verfügbar:" & quote && " with" && tButtonListe into tAuswahl
do tAuswahl
if it is "Cancel" then
exit set_control_positions
else
set_control_positions it
end if
end if
else
put the loc of this stack into tStackLoc
set itemdelimiter to "_"
set the width of this stack to item 1 of pSize
set the height of this stack to item 2 of pSize
set the loc of this stack to tStackLoc
repeat with i = 1 to the number of controls of the current card
set the rect of control i to the tSizeProperty of control i
end repeat
end if
end set_control_positions
-------------------------------------------------------------------
Hallo,
wenn Du damit leben kannst, daß bei einem zu kleinen Bildschirm in den Vollbild-Modus geschalten wird, geht es auch so:
on preOpenStack
-- Das gehört in das Skript der ersten Karte des Stacks!
-- (sonst läuft es jedesmal, wenn irgendein Stack geöffnet wird ...)
get the working screenRect
-- it: 0,0,800,570 - die Koordinaten des aktiven Bildschirms
-- (der hat hier 800x600, abzüglich 30 für Taskleiste/ Menü)
put (item 3 of it - item 1 of it) & comma & (item 4 of it - item 2 of it) into myScreen
-- myScreen: 800,570 - verfügbarer Platz, übersetzt
put the width of this stack into myWidth -- 1024 - die Breite des Stack-Fensters
put the height of this stack into myHeight -- 768 - die Höhe des Stack-Fensters
if (item 1 of myScreen < myWidth) OR (item 2 of myScreen < myHeight) then
-- wenn Fenster zu breit oder zu hoch:
set the fullscreenmode of this stack to "letterbox"
-- dann: skalieren ("showall" gibt das gleiche Ergebnnis)
set the fullscreen of this stack to true
-- Skalierung anwenden durch Anwenden des Fullscreen-Modus!
end if
end preOpenStack