The MP3car.com Store  

Welcome to the MP3Car.com forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. Registering will also remove advertisements. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development > Front Ends > Centrafuse > CF SDK

Reply
 
Thread Tools Display Modes
Old 09-16-2006, 12:20 AM   #1
Low Bitrate
 
Join Date: Jun 2005
Posts: 81
My Photos: (5)
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.
JWise1203 is offline   Reply With Quote
Sponsored Links
Old 09-19-2006, 06:30 PM   #2
Low Bitrate
 
Join Date: Jun 2005
Posts: 81
My Photos: (5)
Any thoughts?
JWise1203 is offline   Reply With Quote
Old 09-19-2006, 09:27 PM   #3
MySQL Error
 
veetid's Avatar
 
Join Date: Apr 2004
Posts: 4,980
My Photos: (0)
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
veetid is offline   Reply With Quote
Old 09-28-2006, 10:33 PM   #4
Low Bitrate
 
Join Date: Jun 2005
Posts: 81
My Photos: (5)
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?
JWise1203 is offline   Reply With Quote
Old 09-28-2006, 10:40 PM   #5
MySQL Error
 
veetid's Avatar
 
Join Date: Apr 2004
Posts: 4,980
My Photos: (0)
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
veetid is offline   Reply With Quote
Old 10-01-2006, 08:39 PM   #6
Low Bitrate
 
Join Date: Jun 2005
Posts: 81
My Photos: (5)
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
 
JWise1203 is offline   Reply With Quote
Old 10-02-2006, 10:16 AM   #7
MySQL Error
 
veetid's Avatar
 
Join Date: Apr 2004
Posts: 4,980
My Photos: (0)
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
veetid is offline   Reply With Quote
Old 10-02-2006, 10:23 AM   #8
Low Bitrate
 
Join Date: Jun 2005
Posts: 81
My Photos: (5)
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.
JWise1203 is offline   Reply With Quote
Old 10-02-2006, 03:42 PM   #9
MySQL Error
 
veetid's Avatar
 
Join Date: Apr 2004
Posts: 4,980
My Photos: (0)
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
veetid is offline   Reply With Quote
Old 10-07-2006, 07:01 AM   #10
Low Bitrate
 
Join Date: Jun 2005
Posts: 81
My Photos: (5)
David, any chance that you could help me out with this, this weekend?
JWise1203 is offline   Reply With Quote
Sponsored Links
Old 10-07-2006, 11:44 AM   #11
MySQL Error
 
veetid's Avatar
 
Join Date: Apr 2004
Posts: 4,980
My Photos: (0)
Quote: Originally Posted by JWise1203 View Post
David, any chance that you could help me out with this, this weekend?

you just have a timer, check the length of the string compared to the length of the text field... truncate off a letter and update the label text in the timer...


there are probably a million examples of doing this style of thing on google, just need to apply to CFPlugin functions, which shouldn't be difficult..

I gave you the .NET code to measure a string with a specified font...

david
__________________
__________________
CENTRAFUSE http://www.centrafuse.com
01 Jeep Cherokee Sport 4x4 Installed
M10000/512Mb/20GB, Lilliput 7", Holux GM-210
veetid is offline   Reply With Quote
Old 11-03-2006, 10:21 PM   #12
Low Bitrate
 
Join Date: Jun 2005
Posts: 81
My Photos: (5)
Ok David,

I haven't gotten a chance to look at this till tonight ... I have gotten the out of bounds exception to work properly by modifying your sample code slightly.

Basically I needed to get the height or area and not just the width of the label rectangle, since I am concerned about the text going going out of bounds vertically.

Code:
string text = strMessage; CFControls.skinLabel temp = (CFControls.skinLabel)labelArray[CF_getLabelID("MESSAGEWINDOW")]; 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; int iHeight = (int)g.MeasureString(temp.Text, temp.Font, 0, sf).Height; int iArea = iWidth * iHeight; if(iArea > (temp.Bounds.Width * temp.Bounds.Height)) { //Do What you need to do because the text is too long System.Diagnostics.Trace.WriteLine("*************** Caught OOB!!! *****************"); System.Diagnostics.Trace.WriteLine("Text Area: " + iArea); System.Diagnostics.Trace.WriteLine("Rec Area: " + (temp.Bounds.Width * temp.Bounds.Height)); System.Diagnostics.Trace.WriteLine("*************** Caught OOB!!! *****************"); } g.Dispose(); labelArray[CF_getLabelID("MAINTITLE")] = temp; this.Invalidate(new Rectangle(temp.Bounds.X, temp.Bounds.Y, temp.Bounds.Width, temp.Bounds.Height), false); }


The label is only getting updated when a message is sent or received, not off of a timer.

Now that I have the code working which will fire when the text is out of bounds I have two issues left:

1. When the message text is out of bounds, only display the end of the message (sort of like the ScrollToCarret method for a textbox).

2. Provide the user the ability to scroll through the entire message by pressing up and down arrows.

My question to you is if this can be done through th exposed CF API?
Attached Images
 
JWise1203 is offline   Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash Skin Tutorial? Cruizer RR Skins 49 01-10-2008 11:02 AM
Label with word wrap Chuck Road Runner 8 09-16-2006 09:02 AM
Debugger Label Idea lostreception Road Runner 3 09-08-2006 01:58 AM
Label that will toggle LABELCODE possible ? Passe RR Skins 8 05-20-2006 11:09 AM
M1-ATX - Q2 part label - please help cclass Power Supplies 8 08-07-2005 01:14 AM


All times are GMT -5. The time now is 04:21 AM.


Sponsored Links
The MP3car.com Store

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 1999 - 2008 Mp3Car.com Inc.
Ad Management by RedTyger
Message Board Statistics