Author | Topic: Re: GraQueryTextBox() | |
---|---|---|
Andreas Gehrs-Pahl View the complete thread for this message in: | Re: GraQueryTextBox() on Sat, 07 Mar 2015 18:17:28 -0500 Carlos, First, showing screen shots of your code is a bad idea. It makes your posts unnecessary large while making it impossible to compile or even copy and paste your code. Second, your screen shots don't tell us anything about what you want to do or what the actual values of your Font variable is, or in which order your code snippets are executed. Third, the statement: oPS:SetFont(AppDeskTop():SetFont()) is redundant and probably the cause of your problem, as you (apparently) created oPS with the statement: oPS := XbpPresSpace():New():Create(AppDesktop():WinDevice()), so the AppDesktop()'s font would already be set -- unless it is NIL, which is what I suspect the issue here is. Fourth, if you just want to determine the size of the area your cToken text "Individual" will require on the screen, then it might be a much better idea to just use oPS := AppDesktop():LockPS() instead -- and after you are done, free it again with: AppDeskTop():UnLockPS(). Also, if you have a specific XbpPart object that you want to display the text on, like a Static, PushButton, DrawingArea, or Browse Table, just use that specific object's Presentation Space object, like: oStatic:LockPS(), oBrowse:DataArea:LockPS(), etc. instead of AppDesktop(). So, try this instead: LOCAL oTempPS := AppDeskTop():LockPS() LOCAL oFont := oTempPS:SetFont() LOCAL aQuery if oFont # NIL oFont:Configure(cYourFontName) ; GraSetFont(oTempPS, oFont) aQuery := GraQueryTextBox(oTempPS, cToken) oFont:Destroy() endif AppDeskTop():UnLockPS() If you don't want to use a particular font, you can skip the :Configure() and GraSetFont() line, and use the existing font. But if there is no font set, you need to decide on a "Default" font and set it, before checking the size of the output area. Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas.GP@Charter.net web: http://www.Aerospace-History.net |