1. win32lib getTextExtent on XP

Its been reported that the getTextExtent() is not working on Windows XP. 
Can someone confirm this for me, please.



-- 

cheers,
Derek Parnell

new topic     » topic index » view message » categorize

2. Re: win32lib getTextExtent on XP

----- Original Message -----
From: "Tony Steward" <tsteward at dodo.com.au>
To: "EUforum" <EUforum at topica.com>
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

new topic     » goto parent     » topic index » view message » categorize

3. Re: win32lib getTextExtent on XP

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!
> 
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: win32lib getTextExtent on XP

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!
> 
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: win32lib getTextExtent on XP

On Fri, 04 Jul 2003 09:20:52 -0400, 1evan at sbcglobal.net wrote:

>wPrintf( MyWindow, "The string %s is %d by %d pixels", {string,=20
>extent[1], extent[2]} )
should be
wPrintf( MyWindow, "The string %s is %d by %d pixels", {text,=20
extent[1], extent[2]} )

"string" is a type defined in win32lib.

Pete

new topic     » goto parent     » topic index » view message » categorize

6. Re: win32lib getTextExtent on XP

Doh, of course!  That's what I get for "cut and paste" programming. 
Sorry, I'm not fully awake yet :)


Pete Lomax wrote:
> 
> 
> On Fri, 04 Jul 2003 09:20:52 -0400, 1evan at sbcglobal.net wrote:
> 
> 
>>wPrintf( MyWindow, "The string %s is %d by %d pixels", {string, 
>>extent[1], extent[2]} )
> 
> should be
> wPrintf( MyWindow, "The string %s is %d by %d pixels", {text, 
> extent[1], extent[2]} )
> 
> "string" is a type defined in win32lib.
> 
> Pete
> 
> 
> 
> TOPICA - Start your own email discussion group. FREE!
> 
>

new topic     » goto parent     » topic index » view message » categorize

7. Re: win32lib getTextExtent on XP

Works just fine when I use "text" instead of "string"


1evan at sbcglobal.net wrote:
> 
> Doh, of course!  That's what I get for "cut and paste" programming. 
> Sorry, I'm not fully awake yet :)
> 
> 
> Pete Lomax wrote:
> 
>>
>> On Fri, 04 Jul 2003 09:20:52 -0400, 1evan at sbcglobal.net wrote:
>>
>>
>>> wPrintf( MyWindow, "The string %s is %d by %d pixels", {string, 
>>> extent[1], extent[2]} )
>>
>>
>> should be
>> wPrintf( MyWindow, "The string %s is %d by %d pixels", {text, 
>> extent[1], extent[2]} )
>>
>> "string" is a type defined in win32lib.
>>
>> Pete
>>
>>
>> TOPICA - Start your own email discussion group. FREE!
>>
>>
> 
> 
> TOPICA - Start your own email discussion group. FREE!
> 
>

new topic     » goto parent     » topic index » view message » categorize

8. Re: win32lib getTextExtent on XP

On Fri, 04 Jul 2003 09:34:08 -0400, 1evan at sbcglobal.net wrote:

>In Example #2 for getTextExtent in the Win32lib docs, x is declared as a=
=20
>sequence, should be an integer?
I think you are right, and also that
>     btns &=3D create(PushButton, MyWindow, btntext[i], x, y, btnwidth,=20
>btnheight, 0)
should be
	 btns &=3D create(PushButton, btntext[i], MyWindow, x, y, btnwidth,=20
btnheight, 0)

It works then.

Pete

new topic     » goto parent     » topic index » view message » categorize

9. Re: win32lib getTextExtent on XP

On Fri, 04 Jul 2003 10:10:38 -0400, 1evan at sbcglobal.net wrote:

>
>
>Doh, of course!  That's what I get for "cut and paste" programming.=20
>Sorry, I'm not fully awake yet :)
Well, everything you found is a bug in the documentation which should
be fixed.

Pete

new topic     » goto parent     » topic index » view message » categorize

10. Re: win32lib getTextExtent on XP

On Fri, 04 Jul 2003 15:19:47 +0100, Pete Lomax
<petelomax at blueyonder.co.uk> wrote:

>It works then.
Oops, I mean it works on win98, I don't have XP.

Pete

new topic     » goto parent     » topic index » view message » categorize

11. Re: win32lib getTextExtent on XP

----- Original Message -----
From: "Al Getz" <Xaxo at aol.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: win32lib getTextExtent on XP


>
>
> Derek Parnell wrote:
> >
> >
> > Its been reported that the getTextExtent() is not working on Windows XP.
> >
> > Can someone confirm this for me, please.
> >
> >
> > --
> >
> > cheers,
> > Derek Parnell
> >
>
> Hello again Derek,
>
> Does the winlib function call
>     GetTextExtentPoint32A()
> or
>     GetTextExtentPoint32W()

The ASCII version. If I use the Unicode version, don't I have to use UTF-16
encoding?

--
Derek

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu