Re: win32lib getTextExtent on XP
- Posted by 1evan at sbcglobal.net
Jul 04, 2003
Last line should've been
WinMain(MyWindow, Normal)
but that is moot because I still get the same error.
In Example #2 for getTextExtent in the Win32lib docs, x is declared as a
sequence, should be an integer?
However when I run this:
include win32lib.ew
constant MyWindow = createEx(Window,"",0,0,0,640,480,0,0)
procedure Init(integer self, integer event, sequence params)
sequence btntext, extent, btns
integer btnheight, btnwidth
integer x
integer y
-- the strings to measure
btntext = {"&Print", "&Cancel", "&Ok", "&Help"}
-- measure the string
extent = getTextExtent( MyWindow, btntext )
-- calc button dimensions
btnheight = extent[2] + 10 -- adjust for borders
btnwidth = extent[1] + 8 -- adjust for borders
-- Draw the buttons
btns = {}
x = 5
y = 10
for i = 1 to length(btntext) do
btns &= create(PushButton, MyWindow, btntext[i], x, y, btnwidth,
btnheight, 0)
y += btnheight + 1
end for
end procedure
setHandler(MyWindow,w32HActivate,routine_id("Init"))
WinMain(MyWindow,Normal)
I get this:
c:\programming\euphoria\win32lib\include\win32lib.ew:13858 in function
create()
type_check failure, caption is 3
... called from Test.exw:28 in procedure Init()
... called from
c:\programming\euphoria\win32lib\include\win32lib.ew:7121 in fun
ction invokeHandler()
... called from
c:\programming\euphoria\win32lib\include\win32lib.ew:24104 in pr
ocedure openWindow()
... called from
c:\programming\euphoria\win32lib\include\win32lib.ew:24356 in pr
ocedure WinMain()
... called from Test.exw:35
--> see ex.err
Warning: parameter self in Init() in Test.exw is not used
Warning: parameter event in Init() in Test.exw is not used
Warning: parameter params in Init() in Test.exw is not used
Press Enter...
1evan at sbcglobal.net wrote:
>
> I dunno. When I run this:
> include win32lib.ew
>
> constant MyWindow = createEx(Window,"",0,0,0,640,480,0,0)
>
>
> procedure Init(integer self, integer event, sequence params)
> sequence text, extent
>
> -- the string to measure
> text = "Hi, there!"
>
> -- measure the string
> extent = getTextExtent( MyWindow, text )
>
> -- show results
> wPrintf( MyWindow, "The string %s is %d by %d pixels", {string,
> extent[1], extent[2]} )
>
> end procedure
> setHandler(MyWindow,w32HActivate,routine_id("Init"))
>
> WinMain()
>
> I get this:
> Test.exw:17
> Syntax error - expected to see possibly '(', not ','
> wPrintf( MyWindow, "The string %s is %d by %d pixels", {string,
> extent[1], exten
> t[2]} )
> ^
>
> Press Enter...
>
>
> Derek Parnell wrote:
>
>>
>> ----- Original Message -----
>> From: "Tony Steward" <tsteward at dodo.com.au>
>> To: "EUforum" <EUforum at topica.com>
>> Sent: Friday, July 04, 2003 6:43 PM
>> Subject: RE: win32lib getTextExtent on XP
>>
>>
>>> Hi Derek,
>>> I Use XP home edition with win32lib 57.9 and do not have any trouble
>>> with getTextExtent(). I use if extensively to size buttons and LText.
>>
>>
>> Thanks Tony.
>>
>> I have an app which works fine under win2k, but in XP I'm getting
>> zero-length strings. I'm using getTextExtent to determine the size of
>> text
>> that Buttons and Labels must hold.
>>
>> --
>> Derek
>>
>>
>> TOPICA - Start your own email discussion group. FREE!
>>
>>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>
|
Not Categorized, Please Help
|
|