Scrolling a static control?

Given a narrow "static" control on a dialog, it's text can be set using
SetWindowText("Some looong text here....").  That same long text can be
retrieved with GetWindowText().  What's missing is the ability to select the
text while holding down the left mouse button.  Enabling the SS_NOTIFY style
on the control itself will notify the parent of things like WM_LBUTTONDOWN,
WM_MOUSEMOVE, and WM_LBUTTONUP messages, but can anything be done to scroll
and select the text?

Thanks,
DC


0
2/19/2004 6:10:46 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
549 Views

Similar Articles

[PageSpeed] 8

You cannot do that with a static control. An alternative is to use a
CEditBox control without the following styles

        Border
        Group
        Tab stop

-- 
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------

"David Crow [MCSD]" <david.nospam.crow@pbsnow.nospam.com> wrote in message
news:G_6Zb.1014$uU6.199@newssvr22.news.prodigy.com...
> Given a narrow "static" control on a dialog, it's text can be set using
> SetWindowText("Some looong text here....").  That same long text can be
> retrieved with GetWindowText().  What's missing is the ability to select
the
> text while holding down the left mouse button.  Enabling the SS_NOTIFY
style
> on the control itself will notify the parent of things like
WM_LBUTTONDOWN,
> WM_MOUSEMOVE, and WM_LBUTTONUP messages, but can anything be done to
scroll
> and select the text?
>
> Thanks,
> DC
>
>


0
CheckAbdoul
2/19/2004 7:05:40 PM
Yeah, I can do it with an edit control.  I was hoping that since the static
control actually had the text in it (even though some of it gets cropped),
there would be some way of selecting it.

"CheckAbdoul" <checkabdoul at mvps dot org> wrote in message
news:#A4UIux9DHA.3488@tk2msftngp13.phx.gbl...
> You cannot do that with a static control. An alternative is to use a
> CEditBox control without the following styles
>
>         Border
>         Group
>         Tab stop


0
2/19/2004 9:03:50 PM
No. If you want selectable text that the user can't modify, use a read-only edit control.
It gives you everything you are asking for. You just can't do this in a static control.
(OK, you can. But you would have to spend many days reimplementing the functionality of a
read-only edit control, which seems a silly way to spend time...)
				joe
On Thu, 19 Feb 2004 21:03:50 GMT, "David Crow [MCSD]"
<david.nospam.crow@pbsnow.nospam.com> wrote:

>Yeah, I can do it with an edit control.  I was hoping that since the static
>control actually had the text in it (even though some of it gets cropped),
>there would be some way of selecting it.
>
>"CheckAbdoul" <checkabdoul at mvps dot org> wrote in message
>news:#A4UIux9DHA.3488@tk2msftngp13.phx.gbl...
>> You cannot do that with a static control. An alternative is to use a
>> CEditBox control without the following styles
>>
>>         Border
>>         Group
>>         Tab stop
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
2/20/2004 1:49:32 AM
Reply:

Similar Artilces:

ActiveX controls
Hi, I have composed a couple of ActiveX controls which may or may not be useful, to someone. If not useful, they're at least mildly funky. I hope they are - I would like as many people as possible to please test them and give me feedback, via the link below. Please be forewarned that I am not wishing to spam anyone, I have simply written these as a pastime in order to advance my skills for my own personal satisfaction, nothing commercial. I am looking to improve my general all round capabilities in programming as opposed to data analysis, and am posting my website on this newsgroup because...

ho to handle scrolling event on CListBox
Hi there. I have a two CListBoxes one near another. In first one I'm adding events and in the second one time of event. Something like this: _____ ___________ |10:45 | | Event 1 | |11:30 | | Event 2 | | | | | So, I would like if one of the list boxes is scrolled the another one is following too. How could I done this? Thanks a lot. Hello there! let m_lst1 (for time) and m_lst2 (for event) are control variable of List Boxes so here is simple logic to scroll both listboxes. m_lst2.SetCurSel(m_lst1.GetCurSel()); or why don'...

Variable Control Names
Within a user form I am trying to reduce the amount of code needed to enter text into text box I have two text boxes. TextBox1 and TextBox2 When Command Button 1 is clicked I want the result TextBox1.Text = "This is my test text" When Command Button 2 is clicked I want the result TextBox2.Text = "This is my test text" But I wish to use the same piece of code for both examples. I am missing something here. This is my test example. _____________________________________________________________ Private Sub CommandButton1_Click() setar (1) 'when Command Button 1 is cl...

Remote Control Software?
I'm looking for some decent remote control software for doing tech support with a brain dead user -- actually a set of brain-dead users. I've listed are running Vista/win seven, on the remote side Vista or XP. I'm familiar with LogMeIn. I'm looking for something with similar functionality that requires little if any installation on the remote site. Free would be nice, of course. Thanks. Ross ross m. greenberg wrote: > I'm looking for some decent remote control software for doing tech support > with a brain dead user -- actually a set of brain...

CListCtrl losing selection if control not an item is clicked
I have a dialog with two listctrl's. The contents of listctrl2 is relative to the item selected in listctrl1. Both ListCtrls have the styles: LVS_SHOWSELALWAYS|LVS_SINGLESEL|LVS_REPORT With LVS_SHOWSELALWAYS if my control loses its focus the selection is greyed, this good. Now my problem is that if the user clicks on the listctrl (not an item) the selection bar is lost but the dotted focus remains. If the control loses its focus as well there is not indication as to what item is selected in listctrl1. How can I ensure that an item is always selected in listctrl1, with the selection bar...

Automate Modifications to SMTP connection control
Hi all, We are a reseller of Frontbridge services and currently have many customers using it. Most of our customers are not true IT admins and can barely run their own PC, let alone administer an Exchange server. Our problem is that we use the connection control option (in the Default SMTP Virtual Server in Exchange) to only accept SMTP connections from the IP addresses from Frontbridge. Every once in a while, Frontbridge will add a new IP address to the list and this forces us to visit every customer's Exchange server and add the new address. My question is if there is any way (by eithe...

Problem with drag&drop into a control
Hi all, i have a problem with drag&drop into Skype's control. I implemented a function to drag a file from my app and then drop it into Skype's chat window. But some controls accepted and others can't. How to allow all controls can understand. "James Duy Trinh (VietDoor)" <vietdoor@gmail.com> wrote in message news:%237HMVMFUJHA.5024@TK2MSFTNGP03.phx.gbl... > Hi all, > > i have a problem with drag&drop into Skype's control. I implemented a > function to drag a file from my app and then drop it into Skype's chat > window. But ...

Developing ActiveX controls using MFC in VS.NET
Hi, I am developing an ActiveX control using MFC, which is to be deployed on an web page. If I develop the control using MFC in VS.NET , will the client machine require .NET to be installed on it ? regards, Sachin Sachin Hegde wrote: > Hi, > I am developing an ActiveX control using MFC, which is to be deployed on an > web page. > If I develop the control using MFC in VS.NET , will the client machine > require .NET to be installed on it ? > > regards, > Sachin > > > No. Microsoft slaps the .NET name on everything, even if it does not use the .NET ru...

Scrolling Text Box Within Worksheet From Another
Hi! I'm creating a spreadsheet which is designed to enter updated comments against a customer account for the use by sales people - basically a poor mans CRM system! What I'd like to do is insert some sort of scrollable text screen within a worksheet that links to a raw data worksheet in the same spreadsheet. A little bit like this message box that we type in while posting a message, but pulling back information based on a specific condition like show me all the comments on customer x that have been entered previously. I'd GREATLY appreciate any advise! Nathan, I'm ...

Legnth of text in textbox control
I would like to create a macro that: creates a textbox fills the textbox with the text in "A1". Allows the user to add or edit text in the textbox Then when exiting the textbox: copy the text from the textbox back to "A1" the following macro seems to work ok - except for one problem - i there is a lot of text in "A1" it won't copy it all into the textbox. Private Sub UserForm_Initialize() Dim testtext WksText = Range("A1").Text TextBox1.Text = WksText TextBox1.AutoSize = False TextBox1.WordWrap = True TextBox1.ScrollBars = 2 TextBox1.MultiLi...

Moving controls and their labels together
Hello, In order to conserve space, I'd like to move a single row of controls and their corresponding labels together to the left. I'd like for them to abut each other. Is there a better way of doing this than to do it by hand? Thanks, Ellen EllenM wrote: > Hello, > In order to conserve space, I'd like to move a single row of controls > and their corresponding labels together to the left. I'd like for > them to abut each other. Is there a better way of doing this than to > do it by hand? > > Thanks, > Ellen In design view? You CAN select multiple ...

Re: How to delay ToolTip display time in CListCtrl Control
"Smallfrogs" <super_smallfrogs@hotmail.com> д���ʼ� news:... > Thanks > "Ali R." <nospam@nospam.com> д���ʼ� > news:snPYb.436$1V5.123111568@newssvr11.news.prodigy.com... > > ((CListCtrl > > *)GetDlgItem(IDC_MYLIST))->GetToolTips()->SetDelayTime(TTDT_AUTOPOP,5000); > > > > or if you have variable for your list > > m_MyList.GetToolTips()->SetDelayTime(TTDT_AUTOPOP,5000); > > > > that will set how long it stays up after it is displayed. > > > > Change TTDT_AUTOPOP with TTDT_INITIAL to change the...

why in god's name won't calculated controls work?
I have been trying to no avail to create a calculated field on a form I have used the expression builder, I have typed in code manually, I have tried using full table and field name syntax all without success. In the control source I have =[transactions]![amount] * 2 The table and field names are correct ( they appear in the expression builder) and the amount field is a number data type. All this produces is #name? in the form field Every book and website I have consulted tells me that this should work. I am getting incredibly fed up with this pathe...

Control variabel grayed
Hi When I use the “Add Member Variable Wizard” for an MFC class created in a static library project in Visual Studio .Net 2003, the “Control Variable” checkbox is grayed out. When I do the same thing in Visual Studio 2005 beta, the checkbox is available. We will not be upgrading to 2005 for a while, but we need to create member variable of “control” type for our dialog classes. Is there any way we can get this to work in VS .NET 2003? Thanks much Hmmm. I just did this and it appeared to work just fine. What I do is select the control I want to add the variable for, right-click on ...

Some sort of control blackhole!
You know when you add controls to a form, well everything was going fine until I added a couple of textboxes. For some reason Excel doesn't ack. the existance of these textboxes except in the form edit window. Does anyone know of a way to repair the spreadsheet so that I can reference these controls? I am at work and so can't install any new service packs if this would resolve it. (Not sure which servicepacks have been installed) After saving and reopening the filet his problem has resolved itself. ...

PostMessage with WM_ENABLE to control in parent dialog
In the modeless dialog class I used the following code: HWND control = ::GetDlgItem( ::GetParent( m_hWnd ), IDC_BUTTON_1 ); ::PostMessage( control, WM_ENABLE, (WPARAM) TRUE, 0 ); But the button (IDC_BUTTON_1) is never enabled on the parent dialog. I want to use PostMessage (and only postmessage). How do I do this? Thanks > In the modeless dialog class I used the following code: > > HWND control = ::GetDlgItem( ::GetParent( m_hWnd ), IDC_BUTTON_1 ); > ::PostMessage( control, WM_ENABLE, (WPARAM) TRUE, 0 ); > > But the button (IDC_BUTTON_1) is never enabled on the parent di...

Tabbing between controls
Hi I have a dialog with multiple edit ctrls. Each edit ctrl has the TabStop property set TRUE, yet I cannot tab between the ctrls. Pressing the tab button does not move the tab to the next control. I have set up the tab order. Any ideas of what I need to do next to allow the tabbing? TIA Tony "Tony" <lazyherbert@homeandresting.com> wrote in message news:Oj#8ZSlUGHA.5704@TK2MSFTNGP10.phx.gbl... > Hi > > I have a dialog with multiple edit ctrls. > Each edit ctrl has the TabStop property set TRUE, yet I cannot tab between > the ctrls. > Pressing the tab...

Scroll Bars
Hi Ive added a scroll bar to my worksheet from the forms tools. I want to have a table which is a fixed size and the scroll bar can b used to move to columns across to view all data. i.e. user views a fixed table of 5 columns but data is made up of 1 columns. The scroll bar will move the data. I also want the same use for a chart. Please Help....! ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com Stephen Bullen has a sample chart with scrolling on his web site. Under &#...

Problem with transform XSL that incude asp.net controls and validation controls!!!! #2
Please help me. I have problem with transform xml Protected WithEvents GeneralXMLWeb As System.Web.UI.WebControls.Xml Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim xmldoc As New XmlDocument() xmldoc=result of Function() * GeneralXMLWeb.Document = xmldoc Dim treeView As XslTransform = New XslTransform() treeView.Load(Server.MapPath("file.xslt")) GeneralXMLWeb.Transform = treeView ---------------------------------------------------------------------------- ---------------------------------------- ("file.xslt&qu...

Excel Charts from pivot tables without scroll down bar?
Is there an easy way to copy/paste a pivot table chart into powerpoint without scroll down bars? If you hide them in Excel: On the PivotTable toolbar, choose PivotChart>Hide PivotChart Field Buttons they should also be hidden when you paste the chart into PowerPoint. Angel wrote: > Is there an easy way to copy/paste a pivot table chart into powerpoint > without scroll down bars? -- Debra Dalgleish Contextures http://www.contextures.com/tiptech.html ...

radio controls
I had a dialog project with three groups of three radio controls, each inside a group box. They worked correctly in that each group of three worked independently of the other groups. I copied the project and did a lot of editting, but not to the radio controls. I did play with tab order which might have had some effect. But now the nine radio controls act as a single group. I can initialize them to so one is selected within each group. But when I click on one, all the others turn off. How can I fix this? "Bill Brehm >" <<don't want any spam> wrote in messa...

ImageList Control
Using 2003, XP Pro. Trying to add images using Microsoft ImageList Control 6.0 According to information I have, you use the .Add method to add an image to the list. The Add method is not available for this control. It does not show up in intellisense and when I code it and run it, it thows the error that the method is not supported for this object. So, how do I add images to an imagelist? -- Dave Hargis, Microsoft Access MVP Hi Dave, It took a while, but I finally got there (XP Pro, Access 2002 - I expect it should work in A2003) ... Dim imlx As Object 'declaring ListImage ...

Control Pagebreaks Programatically
I want to print a sheet columns A:N (rows vary) 1 page wide with pagebreaks at certain rows (91+n*90) eg 91,181,271 etc but am having trouble with old manual pagebreaks and the automatic pagebreaks. The code below (modified from earlier advice on this newsgroup) results in pagebreaks above 90,91,178,181,268 and 271 with BottomRow = 328. How do control PageSetup to be one page wide with breaks at 91,181,271? Thanks Laurence ******************************************************* Sub SetPageBreaks() Dim hpb As HPageBreak Sheets("Stuk P").Activate BottomRow = Range("A2000")....

TAB Control
I'm working in Access 2007. When page 2 of a tab control gets the focus, the controls on page 1 are also displayed. Same thing happens on page 3 - Page 1 and 2 controls display. Makes a real mess. This started happening during a time when no changes were made to the DB (at least not by me). Thanks in advance for the help. On Tue, 8 Jan 2008 19:57:00 -0800, baileves <baileves@discussions.microsoft.com> wrote: >I'm working in Access 2007. When page 2 of a tab control gets the focus, the >controls on page 1 are also displayed. Same thing happens on page 3 - Page 1 >...

Email Out of Control
I can't seem to find an exact "search phrase" for this problem, so here are the details. I am using Office/Outlook 2007. When I open a blank email window to write an email, Outlook automatically is adding the lower case letter 'b' in the "To:" field. It continues on and on until the computer beeps and the field cannot hold any more text. I cannot control it. The only way out is to control-alt-delete and close Outlook. Also when opening any of the folders in "My Documents" (or any folder), the window opens and then the computer scrol...