Groups > Symbian > Symbian EPOC Java > Re: newbie question - ImageItem




newbie question - ImageItem

newbie question - ImageItem
Fri, 30 Sep 2005 15:53:36 +010
Hi

Its a Form with a bunch of ImageItem's forming a grid which i want to use as
a menu screen ... How do i let the user navigate the ImageItem icons and use
it as a menu ...

/* CREATES THE IMAGEITEM ICON */
 public javax.microedition.lcdui.ImageItem get_imageItem1() {
        if (imageItem1 == null) {
            // Insert pre-init code here
            imageItem1 = new
javax.microedition.lcdui.ImageItem("inbox",
get_image1(), 0x4400, null);
            imageItem1.addCommand(get_okCommand1());
            imageItem1.setItemCommandListener(this);
            imageItem1.setPreferredSize(32, 32);
           ....

// creates the command action for the ImageItem above
public javax.microedition.lcdui.Command get_okCommand1() {
        if (okCommand1 == null) {
            // Insert pre-init code here

            okCommand1 = new
javax.microedition.lcdui.Command("Command",
javax.microedition.lcdui.Command.OK, 1);
            // Insert post-init code here

        }
        return okCommand1;
    }

The code was created by the NetBeans.flow/screen designer ... In this case,
all i want it to do is call another function, passing a arg (the folder),
which switches to another form.  As you can see i've added a Command to
them, however, when the user clicks the ImageItem a menu pops up ... and
they have to then click the command ... how do i bypass the menu popping up,
so clicking the ImageItem is all u need to do ..

cheers in advance ...





Post Reply
Re: newbie question - ImageItem
Tue, 4 Oct 2005 15:56:22 +0100
Use the setDefaultCommand(...) method rather than the addCommand() method.

For example

  imageItem1.setDefaultCommand(get_okCommand1());

Regards
Martin

"nobody" <anon@anon.com> wrote in message
news:vAElD4cxFHA.2880@extapps30...
>
> Hi
>
> Its a Form with a bunch of ImageItem's forming a grid which i want to use
as
> a menu screen ... How do i let the user navigate the ImageItem icons and
use
> it as a menu ...
>
> /* CREATES THE IMAGEITEM ICON */
>  public javax.microedition.lcdui.ImageItem get_imageItem1() {
>         if (imageItem1 == null) {
>             // Insert pre-init code here
>             imageItem1 = new
javax.microedition.lcdui.ImageItem("inbox",
> get_image1(), 0x4400, null);
>             imageItem1.addCommand(get_okCommand1());
>             imageItem1.setItemCommandListener(this);
>             imageItem1.setPreferredSize(32, 32);
>            ....
>
> // creates the command action for the ImageItem above
> public javax.microedition.lcdui.Command get_okCommand1() {
>         if (okCommand1 == null) {
>             // Insert pre-init code here
>
>             okCommand1 = new
javax.microedition.lcdui.Command("Command",
> javax.microedition.lcdui.Command.OK, 1);
>             // Insert post-init code here
>
>         }
>         return okCommand1;
>     }
>
> The code was created by the NetBeans.flow/screen designer ... In this
case,
> all i want it to do is call another function, passing a arg (the folder),
> which switches to another form.  As you can see i've added a Command to
> them, however, when the user clicks the ImageItem a menu pops up ... and
> they have to then click the command ... how do i bypass the menu popping
up,
> so clicking the ImageItem is all u need to do ..
>
> cheers in advance ...
>
>
>
>
>
>

Post Reply
Re: newbie question - ImageItem
Fri, 7 Oct 2005 16:47:43 +0100
cheers for that :-) ..

"Martin" <martin@dummy.address> wrote in message
news:0UBWVMPyFHA.1036@extapps30...
> Use the setDefaultCommand(...) method rather than the addCommand() method.
>
> For example
>
>   imageItem1.setDefaultCommand(get_okCommand1());
>
> Regards
> Martin
>
> "nobody" <anon@anon.com> wrote in message
news:vAElD4cxFHA.2880@extapps30...
> >
> > Hi
> >
> > Its a Form with a bunch of ImageItem's forming a grid which i want to
use
> as
> > a menu screen ... How do i let the user navigate the ImageItem icons
and
> use
> > it as a menu ...
> >
> > /* CREATES THE IMAGEITEM ICON */
> >  public javax.microedition.lcdui.ImageItem get_imageItem1() {
> >         if (imageItem1 == null) {
> >             // Insert pre-init code here
> >             imageItem1 = new
javax.microedition.lcdui.ImageItem("inbox",
> > get_image1(), 0x4400, null);
> >             imageItem1.addCommand(get_okCommand1());
> >             imageItem1.setItemCommandListener(this);
> >             imageItem1.setPreferredSize(32, 32);
> >            ....
> >
> > // creates the command action for the ImageItem above
> > public javax.microedition.lcdui.Command get_okCommand1() {
> >         if (okCommand1 == null) {
> >             // Insert pre-init code here
> >
> >             okCommand1 = new
javax.microedition.lcdui.Command("Command",
> > javax.microedition.lcdui.Command.OK, 1);
> >             // Insert post-init code here
> >
> >         }
> >         return okCommand1;
> >     }
> >
> > The code was created by the NetBeans.flow/screen designer ... In this
> case,
> > all i want it to do is call another function, passing a arg (the
folder),
> > which switches to another form.  As you can see i've added a Command
to
> > them, however, when the user clicks the ImageItem a menu pops up ...
and
> > they have to then click the command ... how do i bypass the menu
popping
> up,
> > so clicking the ImageItem is all u need to do ..
> >
> > cheers in advance ...
> >
> >
> >
> >
> >
> >
>
>

Post Reply
about | contact