9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Federico Benavento" <benavento@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: Re: [9fans] control(2), createmenu and event(2)-style menues
Date: Fri,  1 Sep 2006 02:25:04 -0300	[thread overview]
Message-ID: <32d987d50608312225s53210e49q4f535ef8a0708159@mail.gmail.com> (raw)
In-Reply-To: <d0797b765889bb6aa94de3573bd8faf4@mail.gmx.net>

hola2u,

On 8/30/06, Sascha Retzki <sretzki@gmx.de> wrote:
>
> Hi,
>
> I want to write a GUI which displays audiodata - I would like the user to be able to select commands based on an 'event-style' rightclick-menue - basicly gview.c for foo.wav.
>
> As some of those commands require selections which could be easily done via radio-buttons for example, I came to the conclusion that control(2) is the way to go.
>
>
> Unfortunetly, I cannot make createmenu() work - and I cannot include event.h alongside control(2) :)
>
> So, I'd like to start with this one:
> Is createmenu() like the right-click menue presented by event.h? I did not yet find any code in the distribution which actually uses that, but maybe I am blind.
>
>
> Here is a pseudo-like version of my test-code, maybe you can point me to the right direction:
>
>         Control *menue;
>
>         initdraw(0, 0, "DAE [main]");
>         initcontrols();
>
>         cs = newcontrolset(screen, nil, nil, nil);
>
>         menue = createmenu(cs,"daemenue");
>         chanprint(cs->ctl,"daemenue add bl0b");
>
>         activate(menue);
>         resizecontrolset(cs);           // calls getwindow() with Refbackup
>
>         for(;;) {
>                 read the channel
>                 tokenize
>                 print() the message because this is test-code
>         }
>
>
> Anything obviously wrong?
>

yes, you created a menu, now you need an event that calls that menu:
chanprint(cs->ctl, "daemenue window 1");

if you had a Control *button, called "button" you could asociate it with
something like:

chanprint(cs–>ctl, "button  format %q", "%q:   daemenu window 1");

I could be wrong, I haven't used control(2) in some time, but I think you'll get
the idea :)

>
> With best regards, Sascha
>
>

-- 
Federico G. Benavento


  parent reply	other threads:[~2006-09-01  5:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-30 20:20 Sascha Retzki
2006-08-30 22:56 ` Martin Neubauer
2006-09-01  5:25 ` Federico Benavento [this message]
2006-09-01  9:49   ` Sascha Retzki
2006-09-01 11:11 ` cej
2006-09-05 19:58   ` Sascha Retzki
2006-09-07 12:00     ` Russ Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32d987d50608312225s53210e49q4f535ef8a0708159@mail.gmail.com \
    --to=benavento@gmail.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).