9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] control(2), createmenu and event(2)-style menues
@ 2006-08-30 20:20 Sascha Retzki
  2006-08-30 22:56 ` Martin Neubauer
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sascha Retzki @ 2006-08-30 20:20 UTC (permalink / raw)
  To: 9fans


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?


With best regards, Sascha



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] control(2), createmenu and event(2)-style menues
  2006-08-30 20:20 [9fans] control(2), createmenu and event(2)-style menues Sascha Retzki
@ 2006-08-30 22:56 ` Martin Neubauer
  2006-09-01  5:25 ` Federico Benavento
  2006-09-01 11:11 ` cej
  2 siblings, 0 replies; 7+ messages in thread
From: Martin Neubauer @ 2006-08-30 22:56 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

See /sys/src/cmd/cmd/samterm/menu.c for a quite comprehensive example
how to create menus. I'm not sure, though, if it is possible to
integrate control(2).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] control(2), createmenu and event(2)-style menues
  2006-08-30 20:20 [9fans] control(2), createmenu and event(2)-style menues Sascha Retzki
  2006-08-30 22:56 ` Martin Neubauer
@ 2006-09-01  5:25 ` Federico Benavento
  2006-09-01  9:49   ` Sascha Retzki
  2006-09-01 11:11 ` cej
  2 siblings, 1 reply; 7+ messages in thread
From: Federico Benavento @ 2006-09-01  5:25 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] control(2), createmenu and event(2)-style menues
  2006-09-01  5:25 ` Federico Benavento
@ 2006-09-01  9:49   ` Sascha Retzki
  0 siblings, 0 replies; 7+ messages in thread
From: Sascha Retzki @ 2006-09-01  9:49 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs, 9fans

> hola2u,

hola2u 2,

We had a talk about that in #9fans, I think it would be interesting to hear your comments:

<fgb> http://cm.bell-labs.com/sources/contrib/fgb/slider.c
<lantis> fgb: mmh I don't see how slider.c could help me, honestly. 
<lantis> so if the user presses the slider, libcontrol prints that into the channel
<lantis> apperently if I right-click in my window, libcontrol does not print anything about that into the channel
<lantis> control(2) does not say anything about that I have to associate something with something so the menu appears, tho :)
<lantis> soo, I am a bit confused.
<fgb> you could create a container like a box control and controlwire it
<fgb> (I guess...)
<fgb> then you get something like "$boxname: event mouse $x $y $but $msec"



-- 


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [9fans] control(2), createmenu and event(2)-style menues
  2006-08-30 20:20 [9fans] control(2), createmenu and event(2)-style menues Sascha Retzki
  2006-08-30 22:56 ` Martin Neubauer
  2006-09-01  5:25 ` Federico Benavento
@ 2006-09-01 11:11 ` cej
  2006-09-05 19:58   ` Sascha Retzki
  2 siblings, 1 reply; 7+ messages in thread
From: cej @ 2006-09-01 11:11 UTC (permalink / raw)
  To: 9fans

Hi!

Why are you, guys, so impressed/infected by Windozish style of doing things?? Isn't acme idea far more impressive? If you're capable of writing apps, why don't you write acme apps in the way acmemail does it?
IMHO, as usually. Were I capable of doing it, would do so.

Cheers, best regards,
++pac.



-----Original Message-----
From: 9fans-bounces+cej=gli.cas.cz@cse.psu.edu [mailto:9fans-bounces+cej=gli.cas.cz@cse.psu.edu] On Behalf Of Sascha Retzki
Sent: Wednesday, August 30, 2006 10:21 PM
To: 9fans@cse.psu.edu
Subject: [9fans] control(2), createmenu and event(2)-style menues


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. 

[snip]




^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [9fans] control(2), createmenu and event(2)-style menues
  2006-09-01 11:11 ` cej
@ 2006-09-05 19:58   ` Sascha Retzki
  2006-09-07 12:00     ` Russ Cox
  0 siblings, 1 reply; 7+ messages in thread
From: Sascha Retzki @ 2006-09-05 19:58 UTC (permalink / raw)
  To: 9fans

> Hi!
> 
> Why are you, guys, so impressed/infected by Windozish style of doing things?? Isn't acme idea far more impressive? If you're capable of writing apps, why don't you write acme apps in the way acmemail does it?

[..]

> I want to write a GUI which displays audiodata


The thing with acme basicly is, it can just do text. I have some ideas about a graphical acme, but not now. :)

See, actually I want to get certain information from the user; If the user wants to convert the data, he uses the right-click menu to select 'convert' - all the other information needed include several things (here: sample rate, channels (with 3d sound, that one becomes really interesting), bits per sample,...), so how would you do that? Presenting a 'command-line' is not really cool - Neither to put those things into the right-click menue. So I hoped createmenu() creates a menue in the style of:


+---------------+
|				|
|	Bl0b: [        ]	|
|				|
|	[Ok]	[Cancal]	|
|				|
+---------------+

I am convinced that it is way better than any alternatives, at least currently.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] control(2), createmenu and event(2)-style menues
  2006-09-05 19:58   ` Sascha Retzki
@ 2006-09-07 12:00     ` Russ Cox
  0 siblings, 0 replies; 7+ messages in thread
From: Russ Cox @ 2006-09-07 12:00 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Pop up an acme window with the defaults
as text, let the user edit and Put or Go or whatever.

Just like editing /mnt/plumb/rules or /dev/vmware.

Russ


On 9/5/06, Sascha Retzki <sretzki@gmx.de> wrote:
> > Hi!
> >
> > Why are you, guys, so impressed/infected by Windozish style of doing things?? Isn't acme idea far more impressive? If you're capable of writing apps, why don't you write acme apps in the way acmemail does it?
>
> [..]
>
> > I want to write a GUI which displays audiodata
>
>
> The thing with acme basicly is, it can just do text. I have some ideas about a graphical acme, but not now. :)
>
> See, actually I want to get certain information from the user; If the user wants to convert the data, he uses the right-click menu to select 'convert' - all the other information needed include several things (here: sample rate, channels (with 3d sound, that one becomes really interesting), bits per sample,...), so how would you do that? Presenting a 'command-line' is not really cool - Neither to put those things into the right-click menue. So I hoped createmenu() creates a menue in the style of:
>
>
> +---------------+
> |                               |
> |       Bl0b: [        ]        |
> |                               |
> |       [Ok]    [Cancal]        |
> |                               |
> +---------------+
>
> I am convinced that it is way better than any alternatives, at least currently.
>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-09-07 12:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-30 20:20 [9fans] control(2), createmenu and event(2)-style menues Sascha Retzki
2006-08-30 22:56 ` Martin Neubauer
2006-09-01  5:25 ` Federico Benavento
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

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).