How to move stack - livecode

I am trying to move a substack up on keyboardactivated using the following code
local lStackLoc,lStackSize
on openstack
set the fullscreenmode of me to "exactFit"
put the loc of this stack into lStackLoc
put the effective working screenRect into lStackSize
end openstack
----------------------
on keyboardactivated
put the effective working screenRect into tStackSize
set itemdel to comma
put item 4 of lStackSize - item 4 of tStackSize into tKeyboardHeight
put item 2 of lStackLoc - tKeyboardHeight into tNewLocY
put item 2 of lStackLoc & "," & tNewLocY into tStackLoc
move stack "mainsub" to tStackLoc
end keyboardactivated
----------------------
on keyboardDeactivated
move stack "mainsub" to lStackLoc
end keyboardDeactivated
The stack does not move. Have I missed something, is it possible to move a substack even it part of it will be off screen?

Is your application running on a mobile device, or on a desktop system?
If running on mobile, stacks always display using the rect of the screen, and you can only display one stack at a time. The fullscreenMode determines how the stack is sized relative to the screen's rect and how the stack's contents are displayed, but you can't move stacks around on a mobile screen.

Related

How to get loaded monitor color profile with Applescript (or command line)?

Is there a way to retreive the loaded monitors color profile with Applescript, or at least with command-line, as I can use command-line in Applescript?
I'm talking about the loaded color profile of all plugged monitors, the ones defined in "System Preferences -> displays -> color"
EDIT: I would like to get the name of the ICC profile, i.e. what is selected in "System Preferences" -> displays -> color", for each connected screen.
Try either of these:
tell application "Image Events" to display profile of displays as list
tell application "Image Events" to display profile of display 1
You can get more (but not many) details in the Image Events dictionary under Image Suite.
Display 0 and Display 1 both seem to produce the same result (built-in display). Display 2 would refer to an external display. I have a very simple set-up so depending upon yours, you may have to experiment.
Getting the display name is the main issue in pre-Catalina systems if you are wanting to match up display names with their color profiles, but results from the system_profiler utility can be massaged to get the names in earlier systems. A little AppleScriptObjC will get the rest:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
on run -- example
set screenProfiles to ""
set theScreens to current application's NSScreen's screens
set displayNames to getDisplayNames(theScreens) -- handle older systems
repeat with i from 1 to (count theScreens)
set profile to localizedName of colorSpace of item i of theScreens
set displayName to item i of displayNames
set screenProfiles to screenProfiles & "Name: " & displayName & return & "Profile: " & profile & return & return
end repeat
display dialog screenProfiles with title "Screen Color Profiles"
end run
to getDisplayNames(screenList)
set theNames to {}
if (get system attribute "sys2") > 14 then -- 10.15 Catalina and later
repeat with screen in screenList
set end of theNames to localizedName of screen
end repeat
else -- munge system profiler data
set displayKey to "<key>_IODisplayEDID</key>"
set nameKey to "<key>_name</key>" & return & tab & tab & tab & tab & tab & tab & "<string>"
set displayInfo to do shell script "system_profiler -xml SPDisplaysDataType"
set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, displayKey}
set {displayItems, AppleScript's text item delimiters} to {text items of displayInfo, tempTID}
repeat with anItem in rest of displayItems
set here to (offset of nameKey in anItem) + (length of nameKey)
set there to (offset of "</string>" in (text here thru -1 of anItem)) - 1
set end of theNames to text here thru (here + there - 1) of anItem
end repeat
end if
return theNames
end getDisplayNames
The NSScreen documentation has a discussion about the primary screen in the list.
I am not suggesting or making any technical suggestion here as I am not qualified to do so and am hugely impressed by the work you all do.
The way I understand windows CM (colour management) is that while many profiles for many devices (including paper) are held in the appropriate folder only one can be used as the system profile. For the monitor profile only what ever is 'set' as the system profile is wanted or needed. If a new monitor profile is created (via calibration) then that system profile will be replaced.

Name of newly opened stack

I have stored a stack in a custom property, using
set the cStack of stack "abc" to \
url "binfile:~/desktop.abc.rev"
This opens the stack:
go inv stack (the cStack of this stack)
The stack needs to be hidden. Due to the nature of the project, I can't know the name of the stack in advance, but I need to know its name to use it. I tried to use the openStacks, because I thought that the last opened stack would appear at the top of the list, but that doesn't work. I also tried the stacks but that doesn't even contain the name of the stack. The last stack causes an error.
How can I get the name of the most recently opened stack?
You could do the following:
put the openstacks into tOpenStacksBefore
go inv stack (the cStack of this stack)
repeat for each line tStack in the openStacks
if tStack is not among the lines of the openstacks then
exit repeat
end if
end repeat
-- tStack now contains the name of your stack
Basically you are:
Storing a list of open stacks before you open yours.
Repeating for each of the openstacks to find the one that wasn't in the list before you opened your stack.
Right after you open the stack, you can get the long id of this stack. That allows you to refer to it later.
go inv stack (the cStack of this stack)
put the result into rslt
if rslt is empty then put the long id of this stack into myStack
else put empty into myStack
// example
put fld 1 of myStack into myData

gdb backtrace by walking frame pointers

Sometimes there is some small stack corruption that causes gdb to fail doing a "backtrace", I have created the below gdb macro (x86-64, can be easily made to work for x86) that depends on turning off omit-frame-pointer (i.e. -fno-omit-frame-pointer) and shows me the functions in the backtrace. However, I'd like it to also show parameter values and ideally be able to select one of these frames. (i.e. something such as "frame 0x0123456789ABCDEF").
define et
set $frameptr = $rbp
while $frameptr != 0
set $oldbp = *((void**)($frameptr+8))
print $frameptr
print $oldbp
info symbol $oldbp
set $frameptr = *((void**)($frameptr))
end
end

How to find stack of Project Browser ? - livecode

I want to delete stack with my button.
Here code:
delete stack stackname
Before delete command I want to find stack name of Project Browser.If true is pass command.
How do I do ?
You want to use either the revloadedStacks() function, or the openstacks() function. Possibly you're also interested in the mainstacks() function. I suggest you check them all out in the dictionary.
on mouseUp
put revloadedstacks() into field 1
end mouseUp

How to get list card of stack ? - livecode

I want to get list card and list objects of stack by name.
Before.I ask question "How to find stack of Project Browser ? - livecode".I can do it.
Now.I want to get list card and list objects of stack by name.
Can anyone show example code for me please ?
Here my code for get number of cards of this stack
answer the number of cards of this stack
But my code this error for get name card
answer the name of cards of this stack
-------I can solve this problem-------
on mouseUp
put the number of cards of this stack into numC
repeat with crd = 1 to the number of cards of this stack
answer the name of card crd
end repeat
end mouseUp
Here's an example that creates an array with the stack card names as keys. Each array element contains a list of the controls for the card.
on mouseUp
local tCurrentStack, tCards, tCurrentCard, tControlsA
put "MyStack" into tCurrentStack
put the cardNames of stack tCurrentStack into tCards
repeat with tCardIndex = 1 to the number of lines in tCards
put line tCardIndex of tCards into tCurrentCard
repeat with tControlIndex = 1 to the number of controls in card tCurrentCard of stack tCurrentStack
put the name of control tControlIndex of card tCurrentCard of stack tCurrentStack & LF after tControlsA[tCurrentCard]
end repeat
end repeat
end mouseUp
to show the controls from card "MyCard"...
put tControlsA["MyCard"]

Resources