×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    4

    io and menu questions

    Hello,

    I'm trying to write a Midlet application and was looking for help with some basic problems which hopefully you can help with or point me in the direction of solutions.

    The application should run on any phone that supports MIDP 1.0 so I'm not using Nokia specific apis.

    1)How do I create a menu which expands to multiple options for the soft key buttons instead of "back", "select"
    2)What's the protocol to write to a local file when using Connecter.open, I tried "file:///" in my emulator which didn't work. Also how do I check if a local file already exists. I couldn't see any file objects in the APIs
    3)If I want to send the user a confirm box do I need to create a new class to append "OK" "cancel" buttons, as the existing confirmation alerts I found didn't have these fields?

    Thanks very much for your help.

    Regards,
    Jonathan

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    1) The command mapping is automatic (controlled by the implementation). If you only have two Commands they'll be mapped to the soft buttons. If you have three or more (assuming a phone with 2 soft buttons here), then one will be mapped to a soft button and the rest will appear under an "Options" Command on the other soft button. Which Command gets mapped where is implementation dependant, and it usually is related to the Command type (second arg in the Command constructor) and priority (third arg in the Command constructor).
    2) There are no file APIs in standard MIDP 1.0, and most phones don't support the "file://" protocol. The only standard way to write to persistent memory is using the RMS (see the javax.microedition.rms package).
    3) You'll have to make you're own Form for this. You don't necessarily have to subclass Form and add a new class; you could just as well new up a Form object and add Commands and text to it. Which approach is better depends on how much you're using this confirmation box. If you only use it in one or two places then I wouldn't subclass a Form for that. If you need to use it in many places in the application then subclassing might be a better choice.

    shmoove

  3. #3
    Registered User
    Join Date
    Jan 2004
    Posts
    4

    thanks

    Thanks for the reply that worked great.

    One question though, if I want to set text on the screen to bold do I need to use g.drawString() method?

    Thanks,
    jonathan

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    You don't have any control over the font in the high-level UI classes (Form, List, etc). If you want to control fonts and stuff you have to subclass a Canvas and then you can use the Graphics object in paint() along with all it's methods (like setFont() and drawString()).
    You should read through a few tutorials about high-level and low-level UI in MIDP before you make the choice of which one to use.

    shmoove

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •