Getting at list box's scroll bars

My CListCtrl saga is nearly at an end. When user clicks an 
item, I pop up a temporary list box in the appropriate 
position so user can select new setting. The only problem 
is that on initial display of the list BOX, the list BOX's 
vertical scroll bar is dead to the mouse until something 
is selected in the list box.

  m_ListBox.SetCurSel( BlahBlah ) ;

  m_ListBox.ShowWindow( TRUE ) ;
  m_ListBox.SetFocus() ;

  m_ListBox.SetCapture() ;

Remove the SetCapture() and the dead mouse problem goes 
away (creating hassle elsewhere). So, presumably I need to 
get a handle to the list box's vertical scroll bar and do 
SetCapture() ... but how do I get at this scroll bar ???

TTFN,
   Jon
0
9/1/2003 1:48:17 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1001 Views

Similar Articles

[PageSpeed] 50

"Jon Evans" <jonathan.evans6REMOVETHIS@virgin.net> wrote in message
news:077d01c3708f$b25dc5b0$a501280a@phx.gbl...
> My CListCtrl saga is nearly at an end. When user clicks an
> item, I pop up a temporary list box in the appropriate
> position so user can select new setting. The only problem
> is that on initial display of the list BOX, the list BOX's
> vertical scroll bar is dead to the mouse until something
> is selected in the list box.
>
>   m_ListBox.SetCurSel( BlahBlah ) ;
>
>   m_ListBox.ShowWindow( TRUE ) ;
>   m_ListBox.SetFocus() ;
>
>   m_ListBox.SetCapture() ;
>
> Remove the SetCapture() and the dead mouse problem goes
> away (creating hassle elsewhere). So, presumably I need to
> get a handle to the list box's vertical scroll bar and do
> SetCapture() ... but how do I get at this scroll bar ???

The ListBox scroll bar like most window scrollbars are probably not real
HWND windows, but non-client areas painted to look like scrollbars.
-- 
Jeff Partch [VC++ MVP]


0
jeffp (1711)
9/2/2003 4:07:22 AM
Oh dear :-(

So, my SetCapture() has to go.

So, the next problem is how to trap the mouse being 
clicked outside of the temporary list box ? OK, if another 
dialog control is clicked then my temp list box loses 
focus, which I already trap. However if they click outside 
the temp list box but NOT on another control then how do I 
trap it ? OK, I could get the dialog to tell the control 
about the click but that seems like a bad design to me.

Why is this click issue important ? Well, I have an image 
on the dialog containg a number of shapes. I have a CList 
Control listing each shape plus a few parameters regarding 
each shape. User clicks on shape in image, associated 
entry in CListCtrl is highlighted. User double-clicks on 
one of the parameters so as to edit it ... which is where 
I pop-up a temporary list box containing the allwed 
settings. With temp box displayed the last thing I want 
the user to do is to be able to click on another shape on 
the image ?

I can see various work-arounds but they are a bit clumsy 
which suggests I'm using the worng approach. Hmmm .. the 
background image is currently painted directly onto the 
dialog ; is this bad ? Should I use a static control and 
load the bitmap into it instead (so when clicked my 
temporary list box looses focus - hopefully!) ?

TTFN,
   Jon

>-----Original Message-----
>"Jon Evans" <jonathan.evans6REMOVETHIS@virgin.net> wrote 
in message
>news:077d01c3708f$b25dc5b0$a501280a@phx.gbl...
>> My CListCtrl saga is nearly at an end. When user clicks 
an
>> item, I pop up a temporary list box in the appropriate
>> position so user can select new setting. The only 
problem
>> is that on initial display of the list BOX, the list 
BOX's
>> vertical scroll bar is dead to the mouse until something
>> is selected in the list box.
>>
>>   m_ListBox.SetCurSel( BlahBlah ) ;
>>
>>   m_ListBox.ShowWindow( TRUE ) ;
>>   m_ListBox.SetFocus() ;
>>
>>   m_ListBox.SetCapture() ;
>>
>> Remove the SetCapture() and the dead mouse problem goes
>> away (creating hassle elsewhere). So, presumably I need 
to
>> get a handle to the list box's vertical scroll bar and 
do
>> SetCapture() ... but how do I get at this scroll bar ???
>
>The ListBox scroll bar like most window scrollbars are 
probably not real
>HWND windows, but non-client areas painted to look like 
scrollbars.
>-- 
>Jeff Partch [VC++ MVP]
>
>
>.
>
0
9/2/2003 11:36:42 AM
Reply:

Similar Artilces:

Dynamic List Box using VBA
I wasn't really sure how to phrase this one -- this isn't your Typical Drop-Down List. I have a SELECT statement which queries SQL Server 2005 and displays the data in Excel. Let's say that a database lists products that have been delivered to 4 different cities, on 3 seperate days -- without knowing (in advance) the delivery dates, how could I create an input/drop-down field to allow the user to specify a particular date? I envision something like this: VBA code produces a list box of delivery dates based on a particular product and city. The user selects a delivery date ...

Using ExecuteQuery to get Listing of Cases
I'm attempting to programatically extract a listing of Cases (similar to the Cases listing in the Case Manager of the CRM app) using the Microsoft.Crm.Platform.Proxy.CRMQuery.ExecuteQuery() method. I can successfully extract Account and Contract info using ExecuteQuery, but I've been unsuccessful in locating a sample of a "QueryXML" string for listing Cases. This is my latest attempt, but I'm not even sure if "Incident" is the correct Entity for what I'm attempting. <fetch mapping='logical'> <entity name='Incident'> <order a...

how to arrange list by first or last name
I am trying to make a list with first, middle, last name , street address, and phone numbers. I like to know how you can review the list by any combination of first name, last name, city, state, and or phone number? hi can you give examples of how your list is layed out. i am thinking a helper column with an extraction formula might work. regards FSt1 "Andy" wrote: > I am trying to make a list with first, middle, last name , street address, > and phone numbers. I like to know how you can review the list by any > combination of first name, last name, c...

Excel data disappeared after getting message about compatibility M
I tried to save changes to a spreadsheet, and received the following message: "Compatibility Report for New Customer List.xls Run on 4/6/2010 19:52 The following features in this workbook are not supported by earlier versions of Excel. These features may be lost or degraded when you save this workbook in an earlier file format. Minor loss of fidelity Some cells or styles in this workbook contain formatting that is not supported by the selected file format. These formats will be converted to the closest format available." I clicked OK, because fidelity is not imp...

Fuse box stencil?
I need to create something to help me identify the switches in my home's fuse box. (I set off the smoke alarm at 11:45 p.m. New Year's Eve because I had a candle burning almost directly under it for several hours.) It was late and I was desperately trying to figure out which switch controlled which circuit. That blasted noise and the knowledge that my neighbor had to hear it didn't help. Surely I'm not the first person to do this. And if I am, so be it. I'll start from scratch but I'm hoping someone can help me. :-) -- JoAnn Paules MVP Microsoft [Publisher] ...

Custom lists from different sheets
Hi to all, I want to create a custom list from linked data from other sheets. Lets say we create the list on 'sheet10' and the values will be taken from: 'Sheet1!A1' , 'Sheet2!A1' , 'Sheet3!A1' ect....and i want the list to continue till 'Sheet9!A1'. I tried to drag the first three link cells (on sheet10),in order to create the list but the next cells didnt jump to: 'Sheet4!A1',Sheet5!A1'.... Does somebody knows the answer.... Thanks in advance Hi One way is to link your formula to the row number, and use this to increment your sheet numbe...

Voting Buttons -- Missing drop-down box in Tracking tab
I have a user on Office 2003 who uses voting buttons in Outlook. She claims that on the Tracking tab of her sent message, a drop-down box should appear at the right side of each user's "response" column showing the voting options -- for her to manually populate if the respondent verbally replies to her. Our outlook 2003 does not have this. I can find nothing on it. What is she talking about, and how can I set up this feature for her? -- Lisa M I think she's wrong. That function exists in a Meeting's Tracking table, not a vote related tracking table from an em...

how can I get a publisher file to acrobat reader
I have a Regestration Form created in publisher 2003. When a confrence addtendee signs on to our web site they need to be able to click on a file (acrobat reader) Hopfuly, and download it and print it so they can fill out the form and mail it off. (I say acobat reader because that seems to be the most common way it's done. I dont see an export in publisher or a inport to acrobat. how can i make this happen You will need a third party program to create the pdf file. Adobe Acrobat but it's spendy or a freebee i.e., Primopdf or another commercial program of modest cost, i.e., PDF-XC...

Viewing missing Contact list
I stupidly tried to combine PST files without backing each up (don't do this!) Now I can't find my main Contacts folder. I see an older, smaller Contacts folder that cam in from the smaller imported PST. I think it is still in the merged PST (500 MB)because it is larger than it was previous to merging. Any ideas on how to view the important Contacts folder would be very appreciated! stevec <slcolucci@yahoo.com> wrote: > I stupidly tried to combine PST files without backing each up (don't > do this!) Now I can't find my main Contacts folder. I see an older, >...

Account listing total doesn't match actual account
Hey all. I've got an interesting problem that hopefully you'll be able to help with. In the Account List of Money 2004, the total for one of my credit cards shows $33.74. Once I click on the account, however, Money says "You owe: $0.00" which is correct. The total in the account ledger is correct and jives with what the credit card company states. Has anyone else run across a problem like this before or does anybody know how to solve it? It's really weird that the two totals don't match; the rest of the accounts are fine and all match. Thanks in advance!!...

List all users with Send AS rights
Hello All, I need to find a utility or script that will show all users who have the Send AS right enabled. I have looked at the script in Microsoft KB Article 912918 and it list all users who have full mailbox rights but do not have Send AS rights. What I need is to list only the users who do have Send AS rights. Is there anyhting that will tell me who has Send AS rights? -- RS MCSE, MCP +I MCP See if this helps. Auditing Send-as and Receive As rights via script http://gsexdev.blogspot.com/2005/12/auditing-send-as-and-receive-as-rights.html James Chong Rschraeger wrote: > Hel...

Outlook 2003 shortcut bar
I created a shortcut to "My Document" folder in Outlook 2003 Shortcut Bar. When I click the shortcut, it will open a separate window for me. But in Outlook 2000, it will show on the righthand side when I click the "My Document" folder shortcut. (same window) Is there a way to setup the Outlook 2003, so that the contents of My Document folder will show on the righthand side of the same outlook window when I click the Outlook 2003 shortcut. (I do not want to see it on a separate window.) Thanks in advance for your help. No, the way it works in Outlook 2003 is show it...

error bars
I have been trying to formulate error bars for a graph. Each point on the graph is made of 3 data points. I am having trouble getting started. The help option odes not seem to be very helpful. It states to click on tools then data series, which does not seem to be an option for me. I can not find such an option. Does anyone know how to do this. If so please help. ...

how can I get outlook to set up my email accounts and have the se.
I keep getting error messages that the email server would not allow access, then the message now says that the email address line in outlook may be wrong, but I have checked it several times, and it is correct. It acts as though my previous attempts have somehow not been erased from the memory of the program. cjseals3 wrote: > I keep getting error messages that the email server would not allow > access, then the message now says that the email address line in > outlook may be wrong, but I have checked it several times, and it is > correct. It acts as though my previous attem...

To Get PC's Information And Send To Excel
Hello all, I would like to have a script to collect all information about some window xp PC's. I need this script to call from a list I have in a text file. I need the Version, SN, Manufacturer, Model and System Type. Can anyone help me? "Drew" <Drew@discussions.microsoft.com> wrote in message news:88883F79-E3B7-4D60-9C7B-0BDC75E83DBB@microsoft.com... > Hello all, > > I would like to have a script to collect all information about some window > xp PC's. I need this script to call from a list I have in a text file. I > need > the Ve...

How to get combo box selected index changed event in another page from the existing page in winforms
Hi, I am working on windows forms project. I have two winforms (window1 and window2). I have a combobox called cmbEmail in window1 and Textbox called txtName in window2. I want to retrieve some information into the txtName in window2 when I selected something from cmbEmail in window1. If I write code to retrieve something into the txtName (which is in window2) in cmbEmail SelectedIndexchanged event in window1, I will get an error of txtName doesn't exist in this page. Can anybody help me to solve this problem.. Thanks and Regards Naresh "Naresh" &...

export autocorrection list excel2K to excel2003 ?
I try to transport excel2000( UK) autocorrection list to another computer using excel2003 (DUTCH). So far with no succes. Then I made a spreadsheet containing all the autocorrections in 3 columns (error, autocorrection, RTF not true). Then I used the support.dot template (word) in office 2003 to restore/backup the autocorrection list and added the data of my spreadsheet to the 'autocorrect backup document. doc' . Now the autocorrections are available in word2003 but not excel ? In office 2003 autocorrections are shared between programs , but as far as I see only in one direction: if I ...

How do I get column headings to stay visible at all times in Exce.
I need the column headings to stay visible at all times on teh screen, and not just when you print the document? Hi! Select the ENTIRE row immediately under your column headers then goto Window>Freeze Panes. Biff "nemmettiv" <nemmettiv@discussions.microsoft.com> wrote in message news:323C229B-9E55-41C7-AB90-9021E1FBA8E4@microsoft.com... >I need the column headings to stay visible at all times on teh screen, and > not just when you print the document? Hi Select Cell A2. Windows->Freeze Panes to hold row 1 inplace or select B2. windows->Freeze Panes to ...

How do I get a 2 digit date?
I have a control on a form which is a Date/Time control called "txtcd1retd", its fomat is dd/mm/yy There is another control called "txtYear" with it control source =Year([txtcd1retd]). If "txtcd1retd" is 01/02/08 I want txtYear to be 08 but I get 2008. How can I just get 08? Thanks Tony Try: =Format([txtcd1retd], "yy") -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Tony Williams" <tw@invalid.com> wro...

PDK Setup User - Timesheet Settings
How do I change the sort order in the Employee List scrolling window on the left? It is sorting by Employee ID from Payroll not Employee Name. Impossible to find delegates to ADD. 600+ Employees. In Modifier, I switch scrolling windows to the Employee ID List instead of Emploee List but now that window is not linked to the ADD/REMOVE buttons so it looks great but does not work to add/remove delegates. V10 ...

how to get the bus
hello i'm at UpperFilterDevice in the "DriverObject->MajorFunction[IRP_MJ_PNP]" function how to get the bus pdo? ? IoGetAttachedDeviceReference(deviceExtension->NextLowerDriver) i think thats me self?? ? IoGetAttachedDeviceReference(DeviceObject) i think thats right but why don't do this his work? there is no failure but what i get isn't what the HW-Manger me show i will check the DEVICE_CAPABILITIES of the bus (PCI) in the Mj_Pnp routine. Why do you think you need this? Your technique assumes no other filters, the second somebody else h...

I can't get a Bill out of my Budget
Hi, I was wondernig if someone could help me out. I have Money Standard 2004 and have a problem whenever I go to create a new budget. When originally setting up Money, I entered all my Bills into the "manage scheduled bills & deposits" area. I just switched insurance companies ans had to change some bills around. I added my new insurance company and deleted the bills for my old insurance company. When I tried to create a new budget, both the insurance company's bills were showing (even though I deleted my old one). It won't let me delete the field showing my ...

Getting current time into cell as a static value
I want to get the current time into a cell either by clicking in the cell or clicking a pushbutton. Kind of like using =NOW() but once the value should not change after it is initially set. A bit like using Ctrl-Colon but as the spreadsheet will be run on a PDA it needs to be activated by clicking in the cell or a pushbutton. Thanks Ctrl-Shift-Colon? <wadefleming@yahoo.com> wrote in message news:1126044763.859134.103990@o13g2000cwo.googlegroups.com... >I want to get the current time into a cell either by clicking in the > cell or clicking a pushbutton. > > Kind of like ...

how to get several payment dates
Hi all! i can't think of how to do this, mabey someone can help me. i have a tbl employees (not our employees but employees from a company thet we sold to) i have the $ amount sold and the # of payments they have to do (credit) this payments vary in that some are every 7 days others every 14, 15 or 30 days, so say an employee bought $100 in Feb-02-2007 and has a credit of 8 weekly payments: EmpID = 1 EmpAmount = $100 EmpCredit = 8 EmpDays = 7 EmpDate = 02/02/2007 now i need to calculate very date we expect payment from them: EmpID EmpNextPay1 EmpNextPay2 EmpNextPay3 EmpNextPa...

Drop down lists
Hi all Thanks for the info on the drop down lists - has worked perfectly The other thing I want to do is assign a value to the items in the list For example If the item selected is "Gold" then I need to assign a value (in a separate cell) of 100 - if the item is "British Pound" the value assigned need to be 625 I was going to use �f" statements for this but I have way too many items in the list. Any suggestions?? Many thanks Hi Alex On another sheet, make a list with Gold, British Pound etc in column A, and their respective values in column B. Insert>...