[racket] label-string
On Fri, Dec 21, 2012 at 10:59 AM, <heraklea at gmx.de> wrote:
> Ahhhh,
> ok thank you very much. By the way, when I make a tab-panel with multiple
> tabs and add a list-box to the tab-panel it appears on all tab pages. So
> how can I specify the tab/tabindex as parent to the list-box?
>
You need to change the children of the tab-panel when the user changes the
tab. There have been examples of this on the mailing list, so you may
search it for "tab-panel" probably.
Since it's not very obvious how to do it, here is a working example:
http://pastebin.com/2C920yW9
> And is it possible to init the list-box with more choices as one. In the
> example in the doc there is a initialisation only for one column. I would
> like to init say 4 columns with data(as vector or map??).
> For this I don´t found any example, and I hope you could give me the place
> where it stays or an suggestion..
>
Apparently, you can't use the constructor to initialize theother columns,
but you can still do it with `set':
(send a-list-box set choices ...) → void?
choices : (listof label-string?)
Clears the list box and installs a new list of items. The number of choices
lists must match the number of columns, and all choices lists must have the
same number of items, otherwise an exn:fail:contract exception is raised.
Cheers,
Laurent
> Yours,
>
> -------- Original-Nachricht --------
> > Datum: Thu, 20 Dec 2012 12:44:52 +0100
> > Von: Laurent <laurent.orseau at gmail.com>
> > An: murat demirtas <heraklea at gmx.de>
> > CC: racket <users at racket-lang.org>
> > Betreff: Re: [racket] label-string
>
> > Hi,
> >
> > From the Help Desk:
> > (new tab-panel%
> > [choices choices]
> > [...]
> >
> > → (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) → 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
> > >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121221/d86ea8d7/attachment.html>