Displaying a Long Messg on Canvas

Hi All,
Iam having a problem with displaying a long string on Canvas.
I have a long file,which iam taking in a string and Displaying it on a Canvas.
The problem is that the display is only on a single line.
After the end of width of the screen,the string does not continue from a new line.
I want the string to be displayed on first line,after the end of line the string should
continue on next line and so on
Iam using the drawString() function to display my String.It is
graphics.drawString(A very long String, 50, 10, Graphics.LEFT|Graphics.TOP);
If I display it on a Form it works well,But not on a Canvas.
Can u guys help me out with this.
Thanks,
Sangram

Use CurrentFont.charWidth( yourString.charAt(position))
Keep track of the total width and position.
When the total is greater than 95% of your current screen width OR you reach the end of the string.
Work backwards until you hit some type of delimiter (carriage return, space, comma, periods, quotes, +, -, etc...). Remember this as your position for the string to print.
Print the substring. Remove the substring from your current string.
Move your current Y axis printing location down by CurrentFont.getHeight() + someBuffer.
Repeat if there is more string to print.
There's the plain english version of what you want. I leave it up to you to turn it into code.
I bet there's a better way to do it too...

Similar Messages

  • Cinema HD Display no longer comes on immediatley when G5 turned on

    My 23" Cinema HD display no longer comes on immediately when I turn my computer on. The screen stays blank for a few minutes, until I press a button on the keyboard. When the screen finally comes on, the set up for a blue tooth keyboard is displayed. I have the keyboard plugged into the monitor. It has been working fine for the past 8 months. Has anyone seen this before? Do I have to schlep this whole thing to the Apple store for repair?
    G5   Mac OS X (10.4.8)  

    How do you resolve this? I have the same issue.  No power when usb is plugged in.  Replaced power adaptor and it didn't help.  Just blank screen.  Seems like these monitors should hold up better then this.

  • Insignia TV Display, No Longer Usable in 10.8.2

    I have had a 26" Insignia TV Display for the past two years and it worked perfectly, with my prior MacBook Pro and more recently with my new MBP Retina. I also have a Samsung display in my other office and that dispplay works perfectly.
    Yes, NOW THE ISSUE!! Since updated to 10.8.2, I no longer the Insignia display no longer works. I get a black screen on BOTH the MBP Retina and the Insignia display. I can see the pointer of my mouse on the black screen and that is all :-(
    On the Samsung in my other office. All is perfect since updating to 10.8.2.
    What do I do, seems 10.8.2 has made my $500. display USELESS!! What do I do??

    Can Anyone help with this?

  • Opening a new file in photoshopcc and the file name is displayed but no white working canvas. you can see it as a layer in the layers panel and if i draw on the grey area i can see int on the layer but not on the main screen.

    opening a new file in photoshop cc and the file name is displayed but no white working canvas. you can see it as a layer in the layers panel and if i draw on the grey area i can see int on the layer but not on the main screen.

    Graphics card is the problem.
    Trying to update drivers now.
    Thanks for your help
    john

  • Display of long text message

    Helllo Expert,
         I want to display a long message, In module pool program . I have maintain the other message of the program in message class but the long message is not fitting into the message class. the message which I want to display is *"Data saved. Market group (&) and market super group (&) saved. Market (&), market (&) and market super group (&) saved" I have tried using text-xxx but it's not allowing after WITH only 4 field allowed.
    Thanks .

    You can use the function module
    HELPSCREEN_NA_CREATE
    to display the long text of the message!
    Regards
    Naren

  • My iPod is showing a white screen. I could not see anything. But I can listen to songs by blindly pressing the play button twice. The battery comes only for an hour.? How do I get the display and longer battery?

    Hello Friends,
    I've two iPod Nanos (4th gen - 8GB). I'm facing a severe problem with both of them. For both iPods, I tried to do this method Simultaneously press the top button + home (central) button. But of no use.
    1. My first iPod is showing a white screen. I could not see anything. But I can listen to songs by blindly pressing the play button twice. The battery comes only for an hour.? How do I get the display and longer battery?
    2. My second iPod is facing more severe problem. None of the buttons are working. When I connect it my PC it showing "CONNECTED- eject before disconnecting". But it is not ejecting with all the usual methods. When I manually and physically disconnect it from the PC the same "CONNECTED- eject before disconnecting" is still showing till the battery goes off. After that if i press any button it is showing low battery signal. And when i re-connect it to the PC the same process is repeating. When I tied to restore it to the factory settings I'm getting "Error" report.
    (I'm using windows 7)
    Friends, Please help me with the above problems. It will be a great help.
    Thank You.
    R.SAMALA

    Sounds like some hardware issues, meaning you'll want to take or send the iPods in for service or repairs. You can choose to have Apple do an out of warranty exchange for the prices indicated in the link below or find another third party service perhaps even local to your area.
    http://www.apple.com/support/ipod/service/prices/
    B-rock

  • Buttons on 20" Display No Longer Work

    For the past two years I've been using my 20" Apple Cinema Display (the one with the white edges, not the newest version) with my 12" PowerBook by connecting it through Apple's ADC to DVI adapter and plugging it into the Mini-DVI slot on my PowerBook. It worked great and I especially liked how the power button on the display would turn the computer on without the need to open the lid of the PowerBook.
    I just bought a Black MacBook Pro last night, used the Migration assistant to transfer over my User folder. All works fine except the buttons on the display no longer does anything. I'll push it and it will glow but it doesn't seem any signal is sent to the MacBook. The display works fine when plugged in but neither the power button or the brightness button works anymore with the new MacBook.
    Very frustrating...any ideas?
    MacBook 2.0 GHz Core Duo   Mac OS X (10.4)  

    While its hugely unlikly to be RAM related and more than likely the problem is due to lack of support via the DVI connector. I would probably look in two places…
    1) The cinema displays forums…
    http://discussions.apple.com/category.jspa?categoryID=111
    It is possible this issue exists with other Macs and the solution posted.
    2) Call AppleCare. You are current covered by the 90 day telephone support so there's no harm is simply asking.

  • External display no longer working

    I recently purchased a Macbook Pro Retina 13" (Late 2013) model and was able to use it with my external display yesterday. Everything was working great out of the box and I was using the hdmi port on my mac to connect it to my monitor (dvi). Today though when I first turned on my mac after shutting it down for the night, my external display no longer receives a signal.
    I've tested the cable and monitor with another laptop and everything is working, but for some reason just not with my mac.
    I've tried resetting PRAM and SMC, and have been googling how to resolve this but have no luck. Any help would be appreciated.

    So I somehow got it to work again, although it was unexpected, random and 100% luck.
    I think what fixed it was that I switched off and unplugged the power strip that my monitor was connected to (I was reorganizing my cables). I didn't plug my rmbp right away though. The external monitor was still hooked up to my windows laptop. On a whim though I decided to plug the hdmi cable into my rmbp and it worked! My monitor set up also went back to how it was the other day.
    I am sure that I didn't do anything on my rmbp that would have fixed it because I was just browsing internet on it. So if anyone is having this problem of where the monitor used to work but then suddenly didn't then I would suggest them to try this out. Let me know if anyone wants me to recall what I was actually doing. Good luck!
    I think in the future to prevent this from happening again, I will probably unplug my rmbp from the monitor before shutting it down for the night.

  • Display no longer fits correctly on the desktop

    I don't know what I did, but the display no longer fits correctly on the desktop.
    I have to scroll from side to side or up and down to see the entire desktop.
    I went to system preferances Displays and the closest I can get to fitting the desktop to the screen is 1024X680 , but even my desktop pic won't fit on the screen .

    Thank You Charlie, I found this first and it worked:System Preferences>Universal Access, Seeing tab and turn off Zoom.
    But your information is also helpful.
    Thanks for helping

  • Display no longer dims after 3.6.4???

    Kind of noticed this throughout the course of the day so I just tested it to be sure and after testing I'm positive that ever since around the time of the update today my display no longer dims.
    Screensaver still works fine though. Guess if you're using a desktop this doesn't really matter
    but on a laptop you need every ounce of juice out of the battery you can muster.
    My overall experience of this update has not been a good one. Not that anything really negative has happened. I haven't encountered the problems other people are but I have found three things in less than 24 hours that indicate to me that this update is vastly different than 3.6.3, which happened to work quite well for me.
    1. ValueClick Corporation (NASDAQ:VCLK) now accompanies my Google search when I use the default search bar. (For those that don't know what I'm talking about, I'm referring to one of the important online advertising companies trying to "help" me with my searches. This happens in the background. The only reason I noticed it is because I monitor my port activity.)
    This wasn't so with prior versions of Firefox. At least as of yesterday it wasn't.
    2. Plug-in container. Added together with this new feature Firefox is now using 100-160K of RAM. That's about twice as much as the 3.6.3 version I was using previously. I'm not even sure why I need a plug-in container, considering that I have never experienced any flash or other plug-in problems in the past.
    3. You guessed it. How did you know? Oh...that's right. Like I stated before, I kind of noticed that my display wasn't dimming throughout the course of the day but didn't pay it much mind.
    Now that I have time I tested it, and sure enough it is not dimming. The fact is it is no longer dimming but this may not be a Firefox issue at all, but I do know for a fact it was fine yesterday.
    I did uninstall a program first thing yesterday before I connected to the internet and Firefox updated so I realize that could very well be the culprit. Either way this is a support forum so I thought I would ask if anyone else has experienced this. If not I can take a likely guess that it's my computer and not the Firefox browser.
    Despite these small complaints, at the end of the day it doesn't really matter. I have windows 7 that I have already integrated with the drivers I need that I haven't gotten around to installing yet, but when I do I will happily download Firefox 3.6.3.
    In reality I'm glad that Mozilla created an alternative to IE for us. I may not be thrilled with this latest version but I do know there are others that work very well for me. The Linux version on Ubuntu works like a charm too.
    In a strange convoluted way I think I may be saying "thanks Mozilla".
    == This happened ==
    Not sure how often

    Mathias,
    Thank you for helping me (any so many others) back up and running :)
    PS - Allowed my desktop (old pentium 4 running winxp) to update to FF3.6.4 and it worked just fine without the updated iMacros. Not sure what is different between the 2 machines, but figured you might like to have the info.
    Tommy

  • Display GL long text in FAGLL03

    Hi Experts,
    When running  FAGLL03 with many GLs, we are unable to view the description of the GL.
    Any idea how can we display GL long text in FAGLL03?
    Any suggestion will be most grateful.
    Thanks in advance.
    Regards,
    Wong

    Hi Wong,
    Do you mean to say that you don't seem to see the G/L account Long text appearing in the first tab in your G/L account?
    If yes then this has to do something with the Screen 2101. There might be some Screen Exit for the transaction FSP0 where this can be controlled. In an ideal case this will not happen.
    Account Group controls the Field Status of the G/L master record and there is a Transaction based field status as well for Create, Change and Display (Define Screen Layout for each transaction).
    Regards,
    Jams

  • Display the  long text in alv by using function modules

    Hi all,
    How to display the  long text in alv by using function modules ?
    Send me any sample code.
    Thanks in advance
    krupali.

    Hello KR,
    Use READ_TEXT and concatenate the first lines of the text.
    CALL FUNCTION 'READ_TEXT'
         EXPORTING
              id       = 'F01'
              language = sy-langu
              name     = lv_name " purchase order with leading zeroes
              object   = 'EKKO'
         TABLES
              lines    = t_lines
         EXCEPTIONS
              OTHERS   = 8.
    You can loop at t_lines and concatenate header in to some other field.
    Best Regards,
    Sasidhar Reddy Matli.
    Edited by: Sasidhar Reddy Matli on Aug 13, 2008 12:25 PM

  • Help displaying an image using the canvas!!!!!!!!

    Hey guys
    I don't know whether I am not grasping some concepts well.I have been going mad trying to get the code working
    Here is the code
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.io.*;
    * @author Administrator
    * @version
    public class MyMIDlet extends javax.microedition.midlet.MIDlet implements CommandListener{
    private Display display;
    private MyCanvas canvas;
    private Command exitcommand = new Command("Exit",Command.SCREEN,1);
    private Image source;
    public MyMIDlet() {
    protected void startApp() throws MIDletStateChangeException{
    if (display == null){
    initMIDlet();
    protected void pauseApp() {
    protected void destroyApp(boolean unconditional)throws MIDletStateChangeException {
    exitMIDlet();
    public void commandAction(Command c, Displayable d) {
    if (c == exitcommand){
    exitMIDlet();
    protected void initMIDlet() {
    display = Display.getDisplay(this);
    canvas = new MyCanvas(this);
    System.err.println("Canvas instiated succesfully");
    canvas.addCommand(exitcommand);
    canvas.setCommandListener(this);
    display.setCurrent(canvas);
    public void exitMIDlet() {
    notifyDestroyed();
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    import java.io.*;
    public class MyCanvas extends Canvas implements Runnable {
    private MIDlet midlet;
    private Image offscreen;
    private Image currentimage;
    private Graphics g;
    //MID profile application
    /** Creates a new instance of MyCanvas */
    public MyCanvas(MIDlet midlet) {
    this.midlet = midlet;
    try{
    currentimage = Image.createImage("/bird0.png");
    }catch(IOException e){
    System.err.println(e.getMessage());
    if (currentimage!= null){
    System.err.println("Image create successfully");
    }else{
    System.err.println("Image not created");
    try{
    Thread t = new Thread(this);
    t.start();
    }catch(Execption e){}
    protected void paint(Graphics g){
    Graphics saved = g;
    int x = getWidth();
    int y = getHeight();
    g.setColor(255,255,255);
    g.drawImage(currentimage,x,y,g.TOP|g.VCENTER);
    public void run() {
    repaint();
    I know for a fact that the Canvas class 's paint method is called by the system and not the application. This poses a problem for me because I am not sure how to pass the image to the piant method, so that it can be painted.
    When I run the program(using J2ME wtk04), this is the outcome.
    Image created succesfully
    Canvas instiatiated successfully
    null
    Here are my questions
    1) when is the paint method precisely called by the system?after a reference to the canvas class is created?
    2) is it wise to create the image when instiating the canvas class?( initially created the image using a separate thread)-when sould the image be created?
    3)how to let the application know when to use the image when painting the display area?
    I am just trying the logistics here. It is very crucial to me to understand the bolts of this as the core f my project fouses on the man machine interface development.(For the project, the cilent application is quering for the map using HTTP)
    I use a png file of size 161 bytes. Is that too big for testing purposes.
    I would all the help that I can get. thanks in advance

    1) when is the paint method precisely called by the system?after a reference to the canvas class is created?
    After the canvas is set as the current display, and after that, after the repaint() is called.
    2) is it wise to create the image when instiating the canvas class?( initially created the image using a separate thread)-when sould the image be created?
    It's better to create the image in the very begining of the program e.g. in the midlet initialization. You can call the created image as often as you like later on
    3)how to let the application know when to use the image when painting the display area?
    you have to tell it :))
    you can use if-then, switch, or anything else
    and you can use clipping too

  • Display a Long Text in ALV report

    Hi,
    I want to display the PO header long text in ALV Report that is 255 character width.
    Please help me out how to do this.
    please it is very urgent
    Thanks and regards
    Krishna

    Use READ_TEXT and concatenate the first lines of the text.
          CALL FUNCTION 'READ_TEXT'
               EXPORTING
                    id       = 'F01'
                    language = sy-langu
                    name     = lv_name " purchase order with leading zeroes
                    object   = 'EKKO'
               TABLES
                    lines    = t_lines
               EXCEPTIONS
                    OTHERS   = 8.
    Regards

  • Display no longer functions correctly after update

    After updating this morning (the only package updated being wayland), the display on my main computer (laptop still works fine) no longer works properly. It is a bit difficult to describe the problem: there is a constantly changing display of symbols in various colours, "behind" which the usual terminal messages are still legible, though a bit garbled. This began right after re-boot following the update. Because the problem is apparent immediately when the display starts with the manufacturer's logo, I thought at first my monitor had given up. But the same problem occurs on a replacement monitor, which leads me to think it is a software problem. Any hints -- or even better -- a solution? X won't start, making it pretty useless. I can still ssh into it from my laptop, but a real solution is required. My graphics card is NVidia, if that matters (Intel on my laptop).
    Many thanks!
    Thea
    PS I should add, I have read other posts from today regarding similar display issues, and this one appears to be different, although perhaps related. I retrograded the wayland package, but the problem remains. Wayland was the only package I updated-- that is, the only difference between pre-update (no problems) and post-update (dispaly does not work properly).
    PPS further details:
    1. The problem is already apparent at start-up (push the ON button): the computer (not the monitor) manufacturer name appears, but the display is in dashed lines.
    2. After Arch Linux boot and login, there are 5 vertical bands each about 4cm (1.5 ") wide of "shimmering" pixel colour squares spaced evenly across the screen, the intervening spaces are "normal" -- that is, display correctly and without problem. So to some extent, still workable. X will not start, giving me an error message:(/var/log/Xorg.0.log)
    NVIDIA: Failed to initialize the NVIDIA kernel module
    with the advice to consult kernel.log. However, this log (and all other kernel logs) is empty.
    3. When the monitor goes into standby mode, the "shimmering" bands are still visible.
    Update 1:
    After mesa update this afternoon (21 Feb.) video display returned to normal (ok, mesa depends on wayland) until trying unsuccessfully to start X. Since then (and also after a couple of reboots) the problem is the same. Am hoping the silence on this issue indicates that work is in progress in fixing it.
    Update 2:
    After a night in a cold office (I live in southern Ontario) and a literally cold boot (but no updates), everything appears to be back to normal.
    Still, it would be nice to know what the problem was.
    Update 3:
    So much for magic. This morning (23 Feb.) after normal system update (no obvious problematic packages relating to graphics) the display oroblem returned, as before. Fresh boot made no difference. What's going on??
    Am re-posting this as a new message. Monday, start of the week, who knows, maybe someone can help.
    Last edited by thea (2015-02-23 14:38:28)

    You are probably better discussing web design elsewhere such as on http://forums.mozillazine.org/viewforum.php?f=25
    There have been changes in Firefox as documented for example
    * https://developer.mozilla.org/en-US/docs/Firefox_15_for_developers
    * https://developer.mozilla.org/en-US/docs/Firefox_16_for_developers
    Is the website/application a publicly available one if so are you able to provide a link. Otherwise maybe post an example of code that is affected.
    You may also wish to check the code for validity with for instance http://validator.w3.org/

Maybe you are looking for

  • Error (-9808) keeps coming up

    i am trying to log into my itunes account but whenever i put in my information and click login then an error message comes up and says "We could not complete your Itunes store request. An unknown error occurred (-9808) There was an error in the Itune

  • My Firefox synced the "wrong way" and I need to recover my bookmarks.

    On Wednesday I opened Firefox on my WORK computer (PC) after a long hiatus and it recommended I refresh Firefox since I hadn't used it in so long. It said it would preserve all my bookmarks, etc. Did so, everything was fine. Yesterday I logged on to

  • Terminal is creating persistent 'invisible' screens

    This is 'solved' but I am puzzled how it arose and am hoping the (rather obvious!) solution might help others who find their Mac doing this. Recently I notice that, when a new window is requested, Terminal creates one but it is not visible except in

  • Upload and Manage files - track order not sticking

    I uploaded 5 mp3's today, and have been unable to get the tracks to order the way I want to. I move the tracks to the top of the list view, when I click "Done", some of the tracks move all the way up, others stay where they were or just move up one t

  • Library to be used to create an element tree

    Hi all, My use case is to link all elements together, so that I can form an element tree, Here's the example:                          Element A                                 |            ____________|____________            |