I rethought the alignment of baselines of 2 fields and did not like my previous solution to just move the fields
Here is a solution that uses the margins to do the alignment. The two fields should accommodate for the expected textSizes and should be horizontally aligned. There are occasional differences in alignment usually 1 pixel off due to how fonts report their metrics. One could correct this but the only way to do it that I found was to use a snapshot and then adjust accordingly. Anyone interested in that feel free to mail me. Kind regards Bernd --------------------------------------------------------------------------- on mouseUp local tField1, tField2 put the long id of field "field1" into tField1 put the long id of field "field2" into tField2 alignFieldBaselines tField1, tField2 end mouseUp on alignFieldBaselines pField1, pField2 local tDescent1, tDescent2, tRefVLoc local tFormatRect1, tFormatRect2, tDiff1, tDiff2 local tDefaultMargin put 8 into tDefaultMargin lock screen -- make sure the margins are what is expected set the margins of pField1 to tDefaultMargin set the margins of pField2 to tDefaultMargin -- define a reference vertical position for field 1, both fields use it put the bottom of pField1 - (the height of pField1 div 4) into tRefVLoc -- get rect of text put the formattedRect of char 1 of pField1 into tFormatRect1 put the formattedRect of char 1 of pField2 into tFormatRect2 -- find baseline of text put item 4 of measureText(char 1 of pField1, pField1, "bounds") + 1 into tDescent1 put item 4 of measureText(char 1 of pField2, pField2, "bounds") + 1 into tDescent2 -- calculate offset put tRefVLoc - (item 4 of tFormatRect1 - tDescent1) into tDiff1 put tRefVLoc - (item 4 of tFormatRect2 - tDescent2) into tDiff2 -- adjust topMargins to align text set the topMargin of pField1 to tDefaultMargin + tDiff1 set the topMargin of pField2 to tDefaultMargin + tDiff2 unlock screen end alignFieldBaselines --------------------------------------------------------------------------- _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode