Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Scrollable Label?

  1. #1
    Low Bitrate
    Join Date
    Jun 2005
    Posts
    88

    Scrollable Label?

    Hey David,

    Is it possible to scroll through a label object? Basically I would users to scroll through the text assigned to a label if the data becomes too long to display(Like the Listbox objects) in my plug-in.

    I guess that I could figure out how many lines I can fit in the label and then load parts of the string as the down/up arrow is pressed.

    I noticed that there is the following in the SDK; I just haven't seen it used in the sample code:

    CFControls.skinLabel
    needScroll - Label need scrolling flag (Field)

    Just wanted to see if you might have a recommendation for this.

  2. #2
    Low Bitrate
    Join Date
    Jun 2005
    Posts
    88
    Any thoughts?

  3. #3
    VENDOR - Centrafuse veetid's Avatar
    Join Date
    Apr 2004
    Posts
    5,040
    needScroll is a flag you can set to use if you want too... Labels can be created to scroll, but it would have to be programming in on the plugin side currently...

    it's not that hard to get a temp variable and scroll the lables you need to scroll, pulling off the text and invalidating the lable area...

    david
    __________________
    CENTRAFUSE http://www.centrafuse.com
    01 Jeep Cherokee Sport 4x4 Installed
    M10000/512Mb/20GB, Lilliput 7", Holux GM-210

  4. #4
    Low Bitrate
    Join Date
    Jun 2005
    Posts
    88
    Quote Originally Posted by veetid View Post
    needScroll is a flag you can set to use if you want too... Labels can be created to scroll, but it would have to be programming in on the plugin side currently...

    it's not that hard to get a temp variable and scroll the lables you need to scroll, pulling off the text and invalidating the lable area...

    david
    Sorry to be a pain but I am not quite sure how to go about this...

    I would need to set some kind of limit based off of the label itself in order to determine when the string I am loading into the label is too long and has to be split.

    Which properties could I use to accomplish this?

  5. #5
    VENDOR - Centrafuse veetid's Avatar
    Join Date
    Apr 2004
    Posts
    5,040
    Quote Originally Posted by JWise1203 View Post
    Sorry to be a pain but I am not quite sure how to go about this...

    I would need to set some kind of limit based off of the label itself in order to determine when the string I am loading into the label is too long and has to be split.

    Which properties could I use to accomplish this?
    here you go:

    Code:
    string text = "new text for the label";
    CFControls.skinLabel temp = (CFControls.skinLabel)labelArray[CF_getLabelID("NAMEOFMYLABEL")];
    
    if(text != null)
    {
    		temp.Text = text;
    		temp.Draw = true;
    	
    		StringFormat sf = StringFormat.GenericDefault; 
    		sf.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
    
    		Graphics g = this.CreateGraphics();
    		int iWidth = (int)g.MeasureString(temp.Text, temp.Font, 0, sf).Width;
    
    		if(iWidth > temp.Bounds.Width)
    		{
    			//Do What you need to do because the text is too long
    		}
    		
    		g.Dispose();
    		labelArray[CF_getLabelID("MAINTITLE")] = temp;
    		this.Invalidate(new Rectangle(temp.Bounds.X, temp.Bounds.Y, temp.Bounds.Width, temp.Bounds.Height), false);
    }
    david
    __________________
    CENTRAFUSE http://www.centrafuse.com
    01 Jeep Cherokee Sport 4x4 Installed
    M10000/512Mb/20GB, Lilliput 7", Holux GM-210

  6. #6
    Low Bitrate
    Join Date
    Jun 2005
    Posts
    88
    Quote Originally Posted by veetid View Post
    here you go:

    Code:
    string text = "new text for the label";
    CFControls.skinLabel temp = (CFControls.skinLabel)labelArray[CF_getLabelID("NAMEOFMYLABEL")];
    
    if(text != null)
    {
    		temp.Text = text;
    		temp.Draw = true;
    	
    		StringFormat sf = StringFormat.GenericDefault; 
    		sf.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
    
    		Graphics g = this.CreateGraphics();
    		int iWidth = (int)g.MeasureString(temp.Text, temp.Font, 0, sf).Width;
    
    		if(iWidth > temp.Bounds.Width)
    		{
    			//Do What you need to do because the text is too long
    		}
    		
    		g.Dispose();
    		labelArray[CF_getLabelID("MAINTITLE")] = temp;
    		this.Invalidate(new Rectangle(temp.Bounds.X, temp.Bounds.Y, temp.Bounds.Width, temp.Bounds.Height), false);
    }
    david

    I put this code into my plug-in and am having issues with the code thinking the text is out of bounds, when it really isn't.

    I have attached an example of what I am trying to do.

    I am writing a plug-in for AOL Instant Messenger and I need the label to handle two things:

    1. Once the message text becomes to large, automatically scroll the label to show the most current text.

    2. Via the up and down buttons, allow the user to scroll the text in the label and read older text not currently displayed on the screen.


    Hopefully that is descriptive enough, I have tried to work with the example code, but haven't been able to get things working right.
    Attached Images Attached Images  

  7. #7
    VENDOR - Centrafuse veetid's Avatar
    Join Date
    Apr 2004
    Posts
    5,040
    It's as simple as storing the main string in a variable and only updating the labels text with what can fit...


    david
    __________________
    CENTRAFUSE http://www.centrafuse.com
    01 Jeep Cherokee Sport 4x4 Installed
    M10000/512Mb/20GB, Lilliput 7", Holux GM-210

  8. #8
    Low Bitrate
    Join Date
    Jun 2005
    Posts
    88
    Quote Originally Posted by veetid View Post
    It's as simple as storing the main string in a variable and only updating the labels text with what can fit...


    david
    Yes, I guess what I was getting at in the last post was the code you posted was telling me the the main string would be out of bounds when in fact it had plenty of room to fit.

    I was wondering if the code you provided was for another use ... say for the main song title label scroll.

  9. #9
    VENDOR - Centrafuse veetid's Avatar
    Join Date
    Apr 2004
    Posts
    5,040
    Quote Originally Posted by JWise1203 View Post
    Yes, I guess what I was getting at in the last post was the code you posted was telling me the the main string would be out of bounds when in fact it had plenty of room to fit.

    I was wondering if the code you provided was for another use ... say for the main song title label scroll.
    It was, you just asked for an example of how to measure a string I thought... It was just an example, not code to copy/paste and use...

    sorry for the misunderstanding...

    I can help you write what you need after I get RC4 released...

    david
    __________________
    CENTRAFUSE http://www.centrafuse.com
    01 Jeep Cherokee Sport 4x4 Installed
    M10000/512Mb/20GB, Lilliput 7", Holux GM-210

  10. #10
    Low Bitrate
    Join Date
    Jun 2005
    Posts
    88
    David, any chance that you could help me out with this, this weekend?

Page 1 of 2 12 LastLast

Similar Threads

  1. Flash Skin Tutorial?
    By Cruizer in forum RR Skins
    Replies: 49
    Last Post: 01-10-2008, 12:02 PM
  2. Label with word wrap
    By Chuck in forum Road Runner
    Replies: 8
    Last Post: 09-16-2006, 10:02 AM
  3. Debugger Label Idea
    By lostreception in forum Road Runner
    Replies: 3
    Last Post: 09-08-2006, 02:58 AM
  4. Label that will toggle LABELCODE possible ?
    By Passe in forum RR Skins
    Replies: 8
    Last Post: 05-20-2006, 12:09 PM
  5. M1-ATX - Q2 part label - please help
    By cclass in forum Power Supplies
    Replies: 8
    Last Post: 08-07-2005, 02:14 AM

Bookmarks

Posting Permissions

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