Okay I found the issue with the standalone not building properly. I wrote a new
handler to size a window based on the min/max left, top,right,bottoms of every
visible object, so that the "air" or empty space is consistent for every stack
opened. It *sorta* works, as long as the topmost and leftmost of the most
extreme top left objects are where you want them to be. But that is neither
here nor there.
To do this more easily, I gather the rects of every object, along with a few
other properties into an array, then convert the array to a memory database,
where I can query it for the rect,visible and owner properties, excluding
simple groups (not datagrids) and the menu group. The result is a text variable
containing these properties of every object on a card that I queried for, and I
can sort the lines by item 2,3,4 or 5 of each to get the min left and top, and
the max right and bottom of all the objects. Good so far?
All that works a peach in development mode. But in a standalone, something
fails when the app launches AS A STANDALONE. If I open the mainstack in the
standalone folder in the IDE, it ALSO runs fine, so it isn't that something is
going wrong in the build process!!! Just not as a STANDALONE!
Here is the code. After commenting out all the calls to this handler, the
standalone works fine again. I am completely befuddled by this. If anyone can
find fault in this code, which would ONLY cause a problem with a standalone,
I'd love to hear it:
on setWindowRect pCardID
lock screen
put the short name of pCardID into tCardName
if not there is a card tCardName then return "ERROR: No Card ID supplied."
put getParentStack(pCardID) into pStackID
put the left of pStackID into tOldLeft
put the top of pStackID into tOldTop
put tOldLeft into item 1 of tOldTopLeft
put tOldTop into item 2 of tOldTopLeft
put the loc of pStackID into tOldLoc
put "rect,visible,owner" into tPropList
put getCardObjects(pCardID, tPropList) into aCardObjects
put aCardObjects ["props"] into aObjectProperties
put arrayToMemoryDB(aObjectProperties) into tDBID
put "select * from arraydata where" into tQuery
put " visible = 'true'" after tQuery
put " AND (NOT controlname LIKE 'group " & quote & "grp%" & quote & "')"
after tQuery
put " AND (NOT controlname LIKE '%MainMenu%')" after tQuery
put " AND (NOT owner LIKE '%MainMenu%')" after tQuery
if the environment is not "Development" then answer "about to query memory
database."
try
put revDataFromQuery(comma,cr,tDBID,tQuery) into tQueryResults
catch theError
answer theError
end try
revCloseDatabase tDBID
if the environment is not "Development" then answer "just queried memory
database."
sort tQueryResults numeric by item 2 of each
put item 2 of line 1 of tQueryResults into minLeft
sort tQueryResults numeric by item 3 of each
put item 3 of line 1 of tQueryResults into minTop
sort tQueryResults numeric descending by item 4 of each
put item 4 of line 1 of tQueryResults into maxRight
sort tQueryResults numeric descending by item 5 of each
put item 5 of line 1 of tQueryResults into maxBottom
subtract 26 from maxBottom -- Title Bar Height
-- if the platform contains "MAC" then subtract 21 from maxBottom -- for
menubar
-- if the platform contains "WIN" then add 21 to maxBottom
put minLeft + tOldLeft -30 into item 1 of tNewRect
put minTop + tOldTop -45 into item 2 of tNewRect
put maxRight + tOldLeft + minLeft into item 3 of tNewRect
put maxBottom + tOldTop into item 4 of tNewRect
set the rect of pStackID to tNewRect
if the platform contains "WIN" then set the height of pStackID to the height
of pStackID +21
set the topLeft of pStackID to tOldTopLeft
put the effective working screenrect into tScreenRect
put rectWithin(tNewRect, tScreenRect) into tIsWithin
if not tIsWithin then
set the loc of pStackID to the screenLoc -- center window
end if
unlock screen
end setWindowRect
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode