|
My main problem here is that when the Customize dialog begins to show, it disappears again. It's there for less than a second, and my functions to handle the query delete and insert never get called.
In the message map:
ON_NOTIFY(TBN_QUERYDELETE, IDR_TOOLBAR1, OnQueryDelete)
ON_NOTIFY(TBN_QUERYINSERT, IDR_TOOLBAR1, OnQueryInsert)
In the header file:
afx_msg void OnQueryDelete(TBNOTIFY *tbn, LRESULT *result);
afx_msg void OnQueryInsert(TBNOTIFY *tbn, LRESULT *result);
Why is the dialog vanishing without ever calling these functions?
thanks,
Jake
|
|
|
|
|
When I tried placing a RichEdit control in a dialog box, the dialog box would not show when its DoModal function was called. When I removed the RichEdit control, the dialog box showed fine.
What is really odd is the fact that in another project I had a RichEdit control on a property page, and there the dialog box, RichEdit control and all, displayed normally.
Has anyone else had this happen to them? Is there a way to get a popup dialog box with a RichEdit control to display?
"What would this country be without this great land of our?" -Ronald Reagan
|
|
|
|
|
Yu have the AfxInitRichEdit( ); in your CWinApp::initinstance()????
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Didn't do that. Will put that in. Thanks.
"What would this country be without this great land of our?" -Ronald Reagan
|
|
|
|
|
did you call AfxInitRichEdit();?
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I know, I know, this is not a Visual C++ quesiton, but given the fact that most people hitting this site are here for VC++ questions (myself included, ususally), I figured that this would be the best place to give this question exposure.
Any way, I have the following code in a custom Outlook Appointment Form. When I open a new appointment, I get a "Syntax Error" error (reduntant, I know... ). Any idea why?
Function Item_Open()
Dim Insp
Dim Bar
Dim Btn
Set Insp=Item.GetInspector
Set Bar=Insp.CommandBars.Item("Standard")
'Syntax Error appears on this next line...
Set Btn=Bar.Controls.Add(Type:=msoControlButton, Before:=2)
With Btn
.Caption="Board Room"
.FaceID=0
.OnAction="OnBoardRoom"
End With
End Function
Thanks in advance.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
I would like to know how we could insert an icon in a dlgbox
thanks in advance
gerald
|
|
|
|
|
Put a picture control in te dialog box.
Select the properties of picture control.
In the propertie dialog select change the type propertie for Icon.
You will see that the Image Combo box will be enabled. Select in this the resource that have your icon.
Is OK?
cheers!!!!
Carlos Antollini.
|
|
|
|
|
Hi,
I am developing a Document/view application that display different kind of curve. To do so i've used a common CView derived class... but now I want to add some control inside my view on the drawing area. Just for a demo I've insert "false button". ie bitmap picture and I'm trapping their position on LButtonDown... so it's just for demo.
For now I'm seaching a good tutorial or code example who give me the possibility to add all kind of control in a view. I still need to be able to draw (whit dc's function) and to use splitter curve.
So if anyone have something who can help
thank
Rémi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
I'm almost certain you can't add a control to a CView-derived vie wusing the resource editor. You would have to try it programmatically. One idea is to declare a member variable of type CButton, initialize it in your view class's constructor, and then call its Show function in the view's OnDraw function.
I must admit, I'm not entirely clear as to how you would go about handling events from such a button. I believe you have to assign a control ID to the button and use the ON_BN_CLICKED macro to map the message to a specific function.
"What would this country be without this great land of our?" -Ronald Reagan
|
|
|
|
|
Hehe!
Same for me it's the only thing I've found but for now I was'nt able to assing an Id and I don't want to edit myself the ressources. So I derived the class of the control I wanna use and override everything I need. It's not clean but it work... to my mind they must exist a better way to do so.
Still waiting for!
Thank you for you'r answer
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
To assign an ID you just use one of those #define macros. Editing the resource file won't help because everytime the resources are compiled or edited, or soemthing like that, the resource file is erased and written anew.
"What would this country be without this great land of our?" -Ronald Reagan
|
|
|
|
|
The way to declare IDs is to go to the Resources tab, right click on the top level folder and select Resource Symbols. It has an icon of text "ID=", which demonstrates its use as defining global IDs. Click "new" and you can make "ID_BUTTON_SOMETHING" and then use that anywhere in your project.
Handling that button will require adding an entry to the message map. In the cpp file of the class you want to receive the message (your view class, most likely), after the BEGIN_MESSAGE_MAP, add the entry:
ON_COMMAND(ID_BUTTON_SOMETHING, OnButtonSomething).
Button clicks should automatically call the function OnButtonSomething, which you will need to declare in the header file (afx_msg void OnButtonSomething()) and implement in the cpp file.
Hope this helps
Jake
|
|
|
|
|
thank you very much for you'r help. this subject is now a good tutorial "HOW TO: Use any kind of control in a view"
now every control work very well
thanks
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
Hi folks
I'm in the middle of my 1st C++ project and would like a little guidance
where my books seem to be embarrassingly lacking.
I would like to have a function which returns an array of floats,except
(strangely) I can't find any examples of such a function or even a decent
prototype.
It's purely a syntactical question..
Anyone?
Thanks
J
|
|
|
|
|
There are several possable ways to do this. Here are two examples
1. Pass the array to the function by reference:
void MyFunction(float* pFloatArray);
2. Dynamically allocate an array to return:
float* MyFunction()
{
float* pFloat = new float[10];
return pFloat;
}
//In this case be sure to delete the memory when you're done!
void main()
{
float* pFloat = MyFunction();
//do your processing
delete [] pFloat;
}
|
|
|
|
|
here a little example just to explain if
// floatarray.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
bool DoSomethingOnFloat(float *paramFloatArray,int paramSizeOfArray);
bool DoSomethingOnFloat2(float paramFloatArray[],int paramSizeOfArray);
int main(int argc, char* argv[])
{
int i;
float FloatArray[10];
for(i=0;i<200;i++)
{
//filling with garbage
FloatArray[i] = (float)i;
}
DoSomethingOnFloat(FloatArray,10);
DoSomethingOnFloat2(FloatArray,10);
return 0;
}
/******************************************************************
here it's the "pointer way" the weird thing to a newbies is the way
we extract data from the array
******************************************************************/
bool DoSomethingOnFloat(float *paramFloatArray,int paramSizeOfArray)
{
int i;
for(i=0;i
|
|
|
|
|
The advice given is correct, but you can also return a vector of floats, which is safer, but may be a subject you'll learn down the track. I'd suggest buying a good book on STL ( Standard Template Library ) and using it, if not for this assignment, then certainly down the track.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Folks,
Thanks for the help.
zero errors!
J
|
|
|
|
|
OK, hope I can explain my question well enough.
I have data I am reading from a database that I am displaying in a ComboBox. Parts display in ComboBox1 and Units displayed in ComboBox2.
Example data might be Screws/Box, Screws/Bag, Screwdriver/Set, Screwdriver/Single etc. When the user selects the Part I want only relevant Units in ComboBox2.
The only way to do this that I can think of is to read the Parts/Units into an array (say CStringArray) and when Part is selected read through array matching Part and listing Unit.
This gives me the advantage of having the Table and Array index in synch though seems to me to be a slow way of finding and displaying the Unit data.
Is there a better way I should be doing this?
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
|
Units yes, Parts no.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
use a multimap ( STL ). A map alllows you to link values like this
m_Parts["fridge'} = "Big fat cardboard box";
A multimap allows for more than one value to be stored for the same index, so you could create a map entry for each storage type for each unit, and then populate the second combobox based on the first.
The alternative, which might be better, is to use a map and store an array of ints, I think you can do this
map<cstring, vector<int=""> > m_Entries; // but make sure there is a space between the two '>'s
and then create another vector or strings, which is the full list of available units. The vector of ints stores the indexes of the units for that part. This means each string is stored only once. If you wanted to sacrifice some elegance for speed, you could also make the first entry an int, the index of the item. That would be faster, but harder to debug/change.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Hi
I have a program designed to run in the background. In some events, the program should display information about these events. However, if a fullscreen program is running, the info isn't displayed until the user quits his/her fullscreen app. How can I guarantee that the messagebox / dialog always show up?
|
|
|
|
|
how to connect Crystal report with visual C 6.0
plz can any one send me the snip of code or any web site
Thanks
|
|
|
|