Owner Draw Listbox - Inserting strings that go out of context results in garbled display???

I've derived from CListbox, set all the construction parameters using
the resource editor etc etc

char m_cOut[2048];

void CGridtempDlg::OnButton1() 
{
	char cOut[2048];
	

	strcpy(cOut, ("Rate|Start Date|End Date");
	strcpy(m_cOut, "18.8|13/09/04|18/12/22");

	m_lst.AddString(cOut);			//fails (or garbage)
	m_lst.AddString(m_cOut);		//OK
	m_lst.AddString("19.9|19/12/04|");	//OK

}


Do I need to override a CListBox function? 

This all works if my control is a CListBox (but I have to switch off
the ownerdraw property to make it compile...)

Many thanks...


0
8/17/2004 8:57:30 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
506 Views

Similar Articles

[PageSpeed] 55

Here's my own solution...

My mistake was to use the 
DRAWITEMSTRUCT.itemData variable to get my string.

 The string can actually be extracted using :-

CListBox::GetText(lpDrawItemStruct->itemID, strText);

so long as the ListBox has HASSTRINGS setting.













0
8/17/2004 11:29:55 AM
Reply:

Similar Artilces:

I want to insert half of a space instead of a whole space in word.
I want to see if I can insert half a space instead of a "whole" space between words in Microsoft word. On Sat, 6 Feb 2010 10:34:02 -0800, Hucksie <Hucksie@discussions.microsoft.com> wrote: >I want to see if I can insert half a space instead of a "whole" space between >words in Microsoft word. In the Insert > Symbol dialog, you'll find an "en space" character at Unicode number 2002. There is no shortcut key assigned to it by default, but you can assign one by clicking the Shortcut Key button in the dialog. If you don't need...

Problem with printing listbox bigger than one page
Hi, I created form "Invoice". It contains few list boxes (like: Brand, Product, Price, etc.). Each list box is big enough to display 50 items. It works in this way: user is chosing product from table Products_tbl and clicks on "Add to invoice" button which adds to each list box new item containg apropriate information about chosen product. At the end, user can print the form. Before it was limited, and user could put max. 50 products on one invoice, but I wanted to get rid of this limitation. I did it in this way: after 50th item, with each added product I extend list boxe...

unable to display inbox folder due to "invalid handle"???
Ran a scandisk that identified a couple of cluster problems, and allowed the computer to fix the problems identified . Since then, whenever trying to access email in OUTLOOK, we get the following message: "Unable to display the foler. The file c:\windows\localsettings\application data\microsoft\outlook\outlook.pst could not be accessed. The handle is invalid." What is going on? ...

How do you display a dialog on startup?
If you want to display a modal (or modeless) dialog when your MFC application first starts up, where do you put it? (This would be a login or an informational dialog that appears on top of the main window.) I tried putting it in the OnInitialUpdate() method in my CView-derived class, but I get asserts. Thanks. In InitInstance of your app(or OnCreate of your mainwindow), you could post a custom message to your mainframe. In its handler, show the dialog. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "Edward W" <EdwardW@discussions.microsoft.com> wrote in message news:...

Date/Time Displayed as 07/tt/jjjj
Hi, I'm new with MS CRM and just testing it. I have a prob with all date/time fields like described in the subject of this post. Timezone is set for all users Problem occurs in all date/time fields in the web application Anyone has a clue? Regards Jan As Administrator, go to Home > Settings > there is an area in there (can't remember what its called) that enable you to change default date/time format "JanScheider" <JanScheider@discussions.microsoft.com> wrote in message news:F1F22171-AEDC-4222-A8CE-3E333B0576CA@microsoft.com... > Hi, > > I'...

Charting 2 pivot data items as one result
I have a pivot table that has a Count of Tools and a count of plants. What I want to chart is the result of the Count of Tools/Count of Plants. I tried using formulas from the PivotTable tools but I can't seem to make it work. I hate to think that I have to write the code to read the pivot table and place the valuse in cells below the pivot table then chart that range. Thanks for the help. Scott Scott - You wouldn't need VBA code to do this. If you know the structure of your pivot table, you can put a formula in a cell or cells outside the pivot table to give you this ...

For Jeff Partch
Hello Jeff Partch, This is a followup for your solution. http://groups.google.co.in/groups?hl=en&lr=&threadm=OBZ71%24R4BHA.1572%40tkmsftngp02&rnum=3&prev=/groups%3Fhl%3Den%26lr%3D%26selm%3DOBZ71%2524R4BHA.1572%2540tkmsftngp02%26rnum%3D3 In that post, you had explained how to highlight search keyword. But you didn't give the necessary code to clear all searched results. I could clear it by refreshing a page. But my requirement is not to allow user to refresh page. Will you please tell me how to clear highligheted keywords using MSHTML? Awaiting for your reply. "...

Outlook 2003
I used to be able to do this in Outlook 2000. The string will be in either the subject or text body...or both. For example: looking for an email message about a specific invoice number 12345. Now, it does not find the number even when I know it's there....and can find it by hunting on my own. Thanks for any help you can offer~ "Hello_It''''s_Me-CA" <HelloItsMeCA@discussions.microsoft.com> wrote in message news:B942C394-5363-49BE-AFB3-04E34C1CE4BF@microsoft.com... >I used to be able to do this in Outlook 2000. The string will be in either > t...

Float to string and vice versa
Dear: Can I convert Float to string and string to float like in integert (itoa)? Regards Raed Sawalha wrote: > Dear: > Can I convert Float to string _ecvt(), _fcvt(), _gcvt() or sprintf() > and string to float like in integert > (itoa)? atof() or sscanf() -- Sigurd http://utvikling.com ok when i do this CString strComfortValue ; strComfortValue = objXml->GetChildData(); //here strComfortValue = 0.9999 float fComfortValue = atof(strComfortValue.GetString()); //But the problem fComfortValue = 0.99989998 WHY ? I need to get the same result of strComfortValue ...

INSERT INTO problems
Hi all, I hope this doesn't appear twice, I did it a while ago and it never came up! So here goes again! I am trying to use INSERT INTO to insert one record in to a table (tna feedback) in two fields (USER ID: and DESK/LAPTOP). The values are generated by two different forms; stUser comes from this form and stMachine comes from another form which has been hidden once the user has chosen the value. This part works fine. However, every time I run it I get an "Incomplete Query clause" error message but can't fidure out what I've done wrong! Here is the code: Dim SQL ...

why does Word display my field codes upon opening?
I am using Office 2007, and version 11 of Reference Manager. When I open my document, both the Reference Manager fields and the page numbers display with the cryptic words in [brakets]. I must Select All and 'toggle field codes' every time. Can I have Word open with the fields already 'toggled'? Office Button>Word Options>Advanced then uncheck the "Show field codes instead of their values" in the Show document content section of the Word Options dialog. -- Hope this helps, Doug Robbins - Word MVP Please reply only to the newsgroups unle...

Displaying daily quote changes
I am a new user to MS Money who recently migrated from Quicken. I can't seem to find a way that will give me daily quote changes in my portfolio. This is Jan. 26, 2008 and it does give me the change but its not a trading day. It also has the same data as the 1-25-08 which it should. If I try to go back to January 22, it just shows the price for the 22 but not the change. Right click in a blank area within the column headers and then click "customize current view". This should show all the fields that can be added, including the "daily change". Frank "ygold...

display time in different time zone
I have list of different time in column A. I would like to display the times in Column B in a different time zone which is 11 hours delayed than the corresponding times in Column A. Would any one help? One way =MOD(A1-11/24,1) format as time and copy down -- Regards, Peo Sjoblom "james" <jjing@sleh.com> wrote in message news:3677A58E-C736-4363-9D39-93A5306FCBF2@microsoft.com... > I have list of different time in column A. I would like to display the times in Column B in a different time zone which is 11 hours delayed than the corresponding times in Column A. Would ...

Report Menu
I have a report and I want to set up a menu so users can filter using a multi select list box. I have seen some sites that show examples of how to do this, but I have never really learned much about list boxes and how to use them. This is my current set up: I have a report called rptByStatusLocation. It has all of the main record summary information for this application. This has a query called qryRecordByLocationReport. I set a form to this as well and created a list box on the form called LstRecordStatus. The rowsource for this is the same field in the query that is in the...

Form results set to go into hidden files - but aren't
Have an address collection page for building my newsletter base. The form is set to return results to hidden files (_private***) and also to email (FrontPage 2003). The email side works fine, but there's nothing going to the hidden files. Tried changing formats, etc, etc, etc but nothing. Whassup? Silly question: are you checking the hidden files on the server or on your PC? They will not be on your PC. A link to the form page will enable us to check the form properties. -- Ron Symonds Microsoft MVP (Expression Web) http://www.rxs-enterprises.org/fp/wf-menu.as...

If Formula for displaying a message
Hi If A1 is equal to or greater than 80 but less than 89,b1 =abc. If A1 is equal to or greater than 90 but less than 99, b1 =def. If A1 is equal to or greater than 100 but less than 119,b1 =ghi-- Please help Thanks Sherees Life isa journey not a destination Try: =IF(AND(A1>80,A1<89),"abc",IF(AND(A1>=90,A1<99),"def",IF(AND(A1>100,A1<119),"ghi",""))) Micky "Sherees" wrote: > Hi > > If A1 is equal to or greater than 80 but less than 89,b1 =abc. If A1 is > equal to or greater than 90 but ...

Web Page doesn't display in e-mail.
When someone sends me web page via e-mail, the web page does not open properly. Instead, I get a bunch of lines that are embedded links in the web page. Is there anyway to have the web page open correctly when I open the e-mai? ...

Public folder default display
Hi, I have an Exchange server 5.5 and I make some forms used by the clients to publish information in public folders. My problem is : How create a default display (server side) for a public folder used by Outlook clients. In my case I want a chronology display. Thank you Michel ...

Printing results on different pc and different printer
Hi, regarding printing functions in windows i am a newcomer. Thats why i dont understand some phenomenon : I am working with MFC. My report uses Times New Roman and Arial. Report was developed under PC A with Epson Printer. PC B using Epson produces the same output. PC C with Lexmark produces a report with tiny capitals, that are barely readable. PC A with lexmark Printer produces a readable result, but different to Epson Printer. What did i forget to implement in my program? How can i produce a result, that is independable from the printer used? Thanks in advance, Matt Are escape seque...

garbled fonts in email body text
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: Power PC Email Client: Exchange I tried deleting those two files in the User>Library>Caches and restarted but this has not fixed my problem. Any other suggestions? <br> primebowler <FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>On 11/19/09 6:31 AM, in article <a href="59babf3a.-1@webcrossing.JaKIaxP2ac0">59babf3a.-1@webcrossing.JaKIaxP2ac0</a>, &quot;<a href="primebowleri@officeformac.com">primebowleri@officeformac....

Where am I going wrong ?
I'm trying to use SetFocus but not suceeding Please would you indicate the error in the following code For c = StartColNo To EndColNo - 1 If Sheets("Template").Cells(RowNo, c) > 0 Then MsgBox "WARNING - This Room is not available" UserForm1.cb_Rooms.SetFocus Exit Sub End If Next c I'm using Windows 7 and Excel 2007 Regards & TIA Try the below For c = StartColNo To EndColNo - 1 If Sheets("Template").Cells(1, c) > 0 Then MsgBox "...

Change the sender to the previous owner when a lead is reassigned
Business scenario is as folllows: A new lead fires a workflow which sends an email to the lead with the owner as the sender. When the lead is reassigned, they want an email to have the PREVIOUS owner as the sender. There is no facility in email to change the SENDER in the email. What is the recommended solution - callout, etc. -- Paul Doyon CRM Consultant -- Paul Doyon CRM Consultant Hi Paul, Very right, Callout is the solution. -- uMar Khan :: MS CRM MVP CRM Freelance Consultant Email :: imumar at gmail dot com Blog :: http://umarkhan.wordpress.com MVP :: https://mvp.support.m...

Calender display
Can some one assist me? I would like to temporarely display the calender and select the date in a form and capture the desired date. I am a novice at this Charles -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200711/1 If you'd like to only have the calendar appear when you need to pick a date, you can use this routine. YourTextBoxName is the name of the box that will hold the date YourCalendarName is the name of your calendar. First, place the calendar where you want it to appear on the form. Next, select the calendar and goto ...

DWORD IP Address to Displayable IP Address
I Have a IP Address which is in the form of DWORD now i wish to display it to user in the Dot format. Any Idea how this can be done I Know this is 4 seperate bytes but how to seperate them ? How about... DWORD dwIP= 0xA90F1011; // 169.15.16.17 CString strIP; strIP.Format( _T("%d.%d.%d.%d"), HIBYTE(HIWORD(dwIP)), LOBYTE(HIWORD(dwIP)), HIBYTE(LOWORD(dwIP)), LOBYTE(LOWORD(dwIP)) ); HTH -- ============ Frank Hickman NobleSoft, Inc. ============ Replace the _nosp@m_ with @ to reply. "vikrant" <vikrant_kpr@hotmail.com> wrote in message news:%233cTDfxxDHA...

Drawing continuously(dynamically) in MFC .
Hi Folks, I have to develop an application in which I would like to paint the screen (view/dialog) as long as the application exists. I am recieving some data from the below layers and I should paint the screen accordingly. In betwwn user may click on the screen , can change the color of the line I have drawn etc. Correct me If I am wrong..If I draw my screen from OnPaint or OnDraw() my application would hang and I want to handle other events also so this option is ruled out. So what may be the solution , I have to remember what I have drawn using some data structure and tell Onpaint funct...