No subject
From: ()
Date: Mon Dec 3 19:58:15 EST 2012 |
|
(new tab-panel%
[choices choices]
[...]
=E2=86=92 (is-a?/c tab-panel%)
choices : (listof label-string?)
So it wants a list of label-string.
Then clicking on `label-string?` gives:
"""
(label-string? v) =E2=86=92 boolean?
v : any/c
Returns #t if v is a string whose length is less than or equal to 200.
This predicate is typically used as the contract for strings that appear in
GUI objects. In some cases, such as the label in a button% or menu-item%
object, the character & is treated specially to indicate that the following
character is used in keyboard navigation. See set-label in
labelled-menu-item<%> for one such example. In other cases, such as the
label on a frame%, & is not treated specially.
"""
So you could do the following:
(define tab-panel (new tab-panel%
(parent dialog)
(choices (map ~a (vector->list Vec)))))
Laurent
On Thu, Dec 20, 2012 at 12:19 PM, <heraklea at gmx.de> wrote:
> Hello friends,
>
> how can I convert a vector (define Vec #(1 2 3 4))
>
> to a label-string to make a tab-panel??
>
> I try this
> (define tab-panel (new tab-panel%
> (parent dialog)
> (choices (vector->list Vec))))
>
> but it fails due to contract violation: expected: label-string?
>
> So what ist a label-string???
>
>
> Yours,
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
--047d7b5da80980a31b04d1474375
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><div>Hi,<br><br></div>From the Help Desk:<br>(new tab=
-panel% <br>=C2=A0 =C2=A0 [choices choices] <br>[...]<br><br>=C2=A0=E2=86=
=92 (is-a?/c tab-panel%)<br>=C2=A0 choices : (listof label-string?) <br><br=
></div><div>So it wants a list of label-string.<br>
</div><div>Then clicking on `label-string?` gives:<br><br>"""=
;<br>(label-string? v) =E2=86=92 boolean?<br><br>=C2=A0 v : any/c<br>Return=
s #t if v is a string whose length is less than or equal to 200.<br><br>Thi=
s predicate is typically used as the contract for strings that appear in GU=
I objects. In some cases, such as the label in a button% or menu-item% obje=
ct, the character & is treated specially to indicate that the following=
character is used in keyboard navigation. See set-label in labelled-menu-i=
tem<%> for one such example. In other cases, such as the label on a f=
rame%, & is not treated specially.<br>
"""<br><br></div><div>So you could do the following:<br><br>=
(define tab-panel (new tab-panel%<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0(parent dialog)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0(choices (map ~a (vector->list Vec)))))<br></div><div class=3D=
"gmail_extra"><br></div><div class=3D"gmail_extra">Laurent<br><br></div><di=
v class=3D"gmail_extra"><div class=3D"gmail_quote">On Thu, Dec 20, 2012 at =
12:19 PM, <span dir=3D"ltr"><<a href=3D"mailto:heraklea at gmx.de" target=
=3D"_blank">heraklea at gmx.de</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">
Hello friends,<br>
<br>
how can I convert a vector =C2=A0(define Vec #(1 2 3 4))<br>
<br>
to a label-string to make a tab-panel??<br>
<br>
I try this<br>
(define tab-panel (new tab-panel%<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0(parent dialog)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0(choices (vector->list Vec))))<br>
<br>
but it fails due to contract violation: expected: label-string?<br>
<br>
So what ist a label-string???<br>
<br>
<br>
Yours,<br>
____________________<br>
=C2=A0 Racket Users list:<br>
=C2=A0 <a href=3D"http://lists.racket-lang.org/users" target=3D"_blank">htt=
p://lists.racket-lang.org/users</a><br>
</blockquote></div><br></div></div>
--047d7b5da80980a31b04d1474375--