Mobility Pack 4.1 - Visual Midlet

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Mobility Pack 4.1 - Visual Midlet

Dave-25

I have hit a brick wall on something that should be simple.

I have tried every button, every right click, etc but just can’t figure this problem out:-

 

It’s just a simple test midlet where you have a LIST screen that has 2, or more EXCLUSIVE options on it and all you do is select one and then the code switches to a different SCREEN based on the option you select. When I have examined the source code the switch is performed with a command==list.SELECT_COMAND, but what is this and where is it because at the moment the code just displays the LIST SCREEN with the options which you can click but that’s all it doesn’t switch screens? I have tried adding a new command and changing it to SELECT_COMMAND but that just appears in a different part of the commandaction.

Reply | Threaded
Open this post in threaded view
|

Re: Mobility Pack 4.1 - Visual Midlet

Martin Ryzl
SELECT_COMMAND is the default select command for IMPLICIT Lists.
In IMPLICIT lists, when you press select command (either default
or provided by setSelectCommand()) currently focused item is
selected and list's command listener is called with this command.

Select command is ignored by EXLUSIVE and MULTIPLE lists. However,
if you add for instance OK command to an EXCLUSIVE list
and set this command as select command - right click on the list |
Properties | Select Command, generated code pattern will remain the
same,  just newly assigned select command will be used instead of
default one:

         } else if (displayable == list1) {
             if (command == okCommand1) { /// <---- here!
                 switch (get_list1().getSelectedIndex()) {
                     case 0:
// For adding user code into this block, select "Design | Screens |
list1 [List] | Elements | List Element" item in the inspector and invoke
property editor on Action property in Properties window.
 
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_helloForm());
                         break;
                     case 1:
// For adding user code into this block, select "Design | Screens |
list1 [List] | Elements | List Element" item in the inspector and invoke
property editor on Action property in Properties window.
 
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_textBox1());
                         break;


and your application will work as expected, i.e. when you select an
item and press ok it will take you to the corresponding screen.

-Martin


Dave wrote:

> I have hit a brick wall on something that should be simple.
>
> I have tried every button, every right click, etc but just can?t figure
> this problem out:-
>
>  
>
> It?s just a simple test midlet where you have a LIST screen that has 2,
> or more EXCLUSIVE options on it and all you do is select one and then
> the code switches to a different SCREEN based on the option you select.
> When I have examined the source code the switch is performed with a
> command==list.SELECT_COMAND, but what is this and where is it because at
> the moment the code just displays the LIST SCREEN with the options which
> you can click but that?s all it doesn?t switch screens? I have tried
> adding a new command and changing it to SELECT_COMMAND but that just
> appears in a different part of the commandaction.
>


--
_______________________________________________________
Martin Ryzl <[hidden email]>
Sun Microsystems, Inc., Prague (GMT+1)
Phone: +420 233 009 130 (x49130), Fax: +420 233 009 299
Reply | Threaded
Open this post in threaded view
|

RE: Re: Mobility Pack 4.1 - Visual Midlet

Dave-25
Are you using a different program? (Netbeans 4.1,Mob pack 4.1) If it was
that simple I would have spotted it before? Right clicking on the list DOES
NOT give an option for assigning an additional/different command as the
select command all I have are:

Right click on command:-

Action properties
    Action
    Action source
Assigned command properties
    Label
    Priority
    Type
Assigned command code properties
    Instance name
    Lazy initialised
    Pre-init code
    Post-init code

Right click on list:-

Properties
    Title
    Type
    Ticker
Code properties
    Index based switch
    Instance name
    Lazy initialised
    Pre-init code
    Post-init code

So I am still in the same position as before.

-----Original Message-----
From: Martin Ryzl [mailto:[hidden email]]
Sent: 26 July 2005 19:32
To: [hidden email]
Subject: [nbusers] Re: Mobility Pack 4.1 - Visual Midlet

SELECT_COMMAND is the default select command for IMPLICIT Lists. In IMPLICIT
lists, when you press select command (either default or provided by
setSelectCommand()) currently focused item is selected and list's command
listener is called with this command.

Select command is ignored by EXLUSIVE and MULTIPLE lists. However, if you
add for instance OK command to an EXCLUSIVE list and set this command as
select command - right click on the list | Properties | Select Command,
generated code pattern will remain the same,  just newly assigned select
command will be used instead of default one:

         } else if (displayable == list1) {
             if (command == okCommand1) { /// <---- here!
                 switch (get_list1().getSelectedIndex()) {
                     case 0:
// For adding user code into this block, select "Design | Screens |
list1 [List] | Elements | List Element" item in the inspector and invoke
property editor on Action property in Properties window.
 
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_helloForm()
);
                         break;
                     case 1:
// For adding user code into this block, select "Design | Screens |
list1 [List] | Elements | List Element" item in the inspector and invoke
property editor on Action property in Properties window.
 
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_textBox1())
;
                         break;


and your application will work as expected, i.e. when you select an item and
press ok it will take you to the corresponding screen.

-Martin


Dave wrote:

> I have hit a brick wall on something that should be simple.
>
> I have tried every button, every right click, etc but just can't
> figure
> this problem out:-
>
>  
>
> It's just a simple test midlet where you have a LIST screen that has
> 2,
> or more EXCLUSIVE options on it and all you do is select one and then
> the code switches to a different SCREEN based on the option you select.
> When I have examined the source code the switch is performed with a
> command==list.SELECT_COMAND, but what is this and where is it because at
> the moment the code just displays the LIST SCREEN with the options which
> you can click but that's all it doesn't switch screens? I have tried
> adding a new command and changing it to SELECT_COMMAND but that just
> appears in a different part of the commandaction.
>


--
_______________________________________________________
Martin Ryzl <[hidden email]>
Sun Microsystems, Inc., Prague (GMT+1)
Phone: +420 233 009 130 (x49130), Fax: +420 233 009 299

Reply | Threaded
Open this post in threaded view
|

Re: Re: Mobility Pack 4.1 - Visual Midlet

Lukas Hasik
You are using MIDP-1.0
Try to convert the Midlet to MIDP-2.0  (right click in Flow Design "Convert to MIDP-2.0") then you'll see even the Select Command in Properties.

Lukas

Dave wrote:
Are you using a different program? (Netbeans 4.1,Mob pack 4.1) If it was
that simple I would have spotted it before? Right clicking on the list DOES
NOT give an option for assigning an additional/different command as the
select command all I have are:

Right click on command:-

Action properties
    Action
    Action source
Assigned command properties
    Label
    Priority
    Type
Assigned command code properties
    Instance name
    Lazy initialised
    Pre-init code
    Post-init code

Right click on list:-

Properties
    Title
    Type
    Ticker
Code properties
    Index based switch
    Instance name
    Lazy initialised
    Pre-init code
    Post-init code

So I am still in the same position as before.

-----Original Message-----
From: Martin Ryzl [[hidden email]] 
Sent: 26 July 2005 19:32
To: [hidden email]
Subject: [nbusers] Re: Mobility Pack 4.1 - Visual Midlet

SELECT_COMMAND is the default select command for IMPLICIT Lists. In IMPLICIT
lists, when you press select command (either default or provided by
setSelectCommand()) currently focused item is selected and list's command
listener is called with this command.

Select command is ignored by EXLUSIVE and MULTIPLE lists. However, if you
add for instance OK command to an EXCLUSIVE list and set this command as
select command - right click on the list | Properties | Select Command,
generated code pattern will remain the same,  just newly assigned select
command will be used instead of default one:

         } else if (displayable == list1) {
             if (command == okCommand1) { /// <---- here!
                 switch (get_list1().getSelectedIndex()) {
                     case 0:
// For adding user code into this block, select "Design | Screens | 
list1 [List] | Elements | List Element" item in the inspector and invoke 
property editor on Action property in Properties window.
 
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_helloForm()
);
                         break;
                     case 1:
// For adding user code into this block, select "Design | Screens | 
list1 [List] | Elements | List Element" item in the inspector and invoke 
property editor on Action property in Properties window.
 
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_textBox1())
;
                         break;


and your application will work as expected, i.e. when you select an item and
press ok it will take you to the corresponding screen.

-Martin


Dave wrote:

  
I have hit a brick wall on something that should be simple.

I have tried every button, every right click, etc but just can't 
figure
this problem out:-

 

It's just a simple test midlet where you have a LIST screen that has 
2,
or more EXCLUSIVE options on it and all you do is select one and then 
the code switches to a different SCREEN based on the option you select. 
When I have examined the source code the switch is performed with a 
command==list.SELECT_COMAND, but what is this and where is it because at 
the moment the code just displays the LIST SCREEN with the options which 
you can click but that's all it doesn't switch screens? I have tried 
adding a new command and changing it to SELECT_COMMAND but that just 
appears in a different part of the commandaction.