|
Depend on his religoius philosophy; whether me destructs when leaving life's scope. (That's almost nausiatingly poetic in a nerdy sort of way. Don't think of it as dying, think of it as going out of scope.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
|
As a bool , it consumes 1 byte. As a bool* , it would consume 4 bytes. Correct? If so, future posts would therefore be 300% larger than necessary!
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
ok for the bool* , but that was an expectation for getting me out of the scope. but what about a bool& ?
TOXCCT >>> GEII power
|
|
|
|
|
Michael Dunn told me "Use the CCS_NOPARENTALIGN style".
I've used it but what I win with this is that I can set up the height free, but I am not able to put 30 pixels from left for example. I use this function to call the CToolBarCtrl:
my_tool_bar.Create(WS_CHILD|WS_VISIBLE|CCS_NODIVIDER|CCS_NOPARENTALIGN, CRect(0, 110, 80, 80), this, IDC_MY_TOOL_BAR);
If I set up like this:
my_tool_bar.Create(WS_CHILD|WS_VISIBLE|CCS_NODIVIDER|CCS_NOPARENTALIGN, CRect(30, 110, 80, 80), this, IDC_MY_TOOL_BAR);
The top fails... I don't know what to do...
Please, if you could put me an example of how to create a CToolBarCtrl with no top or bottom alignment into the window... I want to draw it into a CRect from the Window.
Thanks in advance !!!
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
if ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
Well, I solved it:
my_tool_bar.Create(WS_CHILD|WS_VISIBLE|CCS_NODIVIDER|CCS_NOPARENTALIGN|CBRS_NOALIGN|CBRS_FLYBY, CRect(30, 110, 80, 80), this, IDC_MY_TOOL_BAR);
Thanx anyway !!
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
if ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
Hi all! I had a question concerning visual c++ 6.0. I'm coding a card game in Win32 (no MFC) and am trying to fill an edit box on a dialog window dynamically with child controls. What the program does is it queries the current directory for all sound (.wav) files and, for each sound file, inserts three child controls in the edit box on one line. The controls are, from left to right, an edit box for the caption the user wants for this sound file, a play button to listen to the sound, and a second edit box for the name of the sound file.
I'm inserting these into an edit box because, since the sound list is obviously dynamic and of arbitrary length, I'd like to utilize the scroll bar on the edit box. The problem I'm running into is that the edit box is unaware of anything being added to it. I'm calling CreateWindow to add these controls to the edit box, with the handle to the edit box as the parent parameter, and the lines of child controls for the sound files fill up past the depth of the edit box without the scroll bar being activated.
One solution I tried was to insert a newline character into the edit box for each line of controls I added. This solved the scroll bar problem, but when you scroll the edit box the display gets really confused as to what to display (the controls or the "\n").
Any advice is GREATLY appreciated.
Carl Scafidi
|
|
|
|
|
I've never heard of anything other than text being added to an edit control. Do you have an example that shows this?
cscafidi wrote:
The controls are, from left to right, an edit box for the caption the user wants for this sound file, a play button to listen to the sound, and a second edit box for the name of the sound file.
I'm envisioning a list control with two "columns," one for caption and the other for filename. Each of these can be edited in place. A "Play" button would reside next to the list control and would act upon whatever file is currently selected.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
That is a good point, and it need not be an edit box at all. I'm just looking for something like an edit box with scroll controls that I can add dynamic child controls inside of. Do you have any suggestions?
|
|
|
|
|
cscafidi wrote:
Do you have any suggestions?
Nothing additional.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Here is a code snippet:
int xDim = 0;
int width = SOUND_CAPTION_BOX_WIDTH * cxChar;
//SendMessage(hList,EM_SETLINE,int((idx - SND_FILE_LIST_OFFSET)/HWNDS_PER_SOUND),(LPARAM)TEXT("\n"));
SendMessage(hList,LB_INSERTSTRING, 0, (LPARAM)TEXT("\n\n"));
captionRef = CreateWindowEx(
WS_EX_CLIENTEDGE,
"EDIT",
NULL,
//WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | WS_THICKFRAME,
WS_CHILD | WS_VISIBLE | ES_LEFT,
xDim,
yDim,
width,
cyBox,
hList,
(HMENU)idx,
hInstance,
NULL);
SetWindowText(captionRef,caption);
idx++;
numActiveSoundChildWindows++;
xDim += width;
width = SOUND_PLAY_BTN_WIDTH * cxChar;
playBtnRef = CreateWindow(TEXT("button"),
TEXT(" PLAY "),
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
xDim,
yDim,
width,
cyBox,
hList,
(HMENU)idx,
hInstance,
NULL);
idx++;
numActiveSoundChildWindows++;
xDim += width;
width = SOUND_FILE_NAME_BOX_WIDTH * cxChar;
fileNameRef = CreateWindowEx(
WS_EX_CLIENTEDGE,
"EDIT",
NULL,
WS_CHILD | WS_VISIBLE | ES_LEFT,
xDim,
yDim,
width,
cyBox,
hList,
(HMENU)idx,
hInstance,
NULL);
SetWindowText(fileNameRef,fileName);
idx++;
numActiveSoundChildWindows++;
yDim += cyBox;
the 'hList' is the handle to the edit box.
|
|
|
|
|
One word: OwnerDraw
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
if ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
Hi!. i want to overload operator >>. What i've done so far doesn't work. I'm using visual C++ 6.0. When i place my mouse cursor over s, it says int s. It's the same if instead of writing 'std::string s' i write 'string s', even though in the header file i declared 'typedef std::string string;'
<br />
istream &operator>>(istream& stream, XML &x)<br />
{<br />
<br />
std::string s;<br />
std::getline(stream,s);<br />
x.fromString(s);
return stream;<br />
}<br />
This is how i declared inside the class in the header class.
<br />
friend istream &operator>>(istream &stream, XML &x)
this is what i'm including and using in the header file.
<br />
#include <iostream><br />
using std::istream;<br />
using std:stream;<br />
and in main: using namespace std;
my class is called xml
in main i declare:
<br />
xml table;<br />
cin >> table;<br />
thanks!!
|
|
|
|
|
Hi,
First of all, please tick the "Notify me by e-mail if someone answers this message" checkbox on (right below the editbox for entering the post) so that <'s appear correctly.
As for your problem, which is the behavior you observe? Does the program compile and you get weird results, or if it fails to compile what's the error? With a little more info we'll do a better job trying to help you.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
well, it compiles, and i need to load a string (s)from standard input, but as s is thought as an int, nothing gets loaded in s. And i need a string to be loaded in s so i can call the function toString
thanks!
|
|
|
|
|
Well, I don't think your s is really compiled as an int : sometimes the intellisense feature (by which you guessed the variable was being treated like an int ) gets crazy, that's all.
I'd try the following:
1. Make sure you already have a proper #include<string> .
2. To rule out some problem with getline , replace that line (just for testing purposes) with something like
s="hello world"; or whatever. What happens now? Does this shed some light on your problem?
3. After the getline output the contents of s to cout to see what it has been fed with.
Hopefully, some of these measures will make it clear where the problem lies. Good luck, don't hesitate to come back if you can't come up woth a solution.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
well, nice suggestions!!
i placed s="hello world"; and s loaded succesfully!.
i also did
std::cin >> s;
and i loaded the string succesfully. The toString function worked ok, but the stream i returned was empty, so nothing happened back at the main program
so what doesn't work is
std::getline(stream,s);
after the getline, there's nothing in s, i debugged it.
don't know why tough
thanks for your help
|
|
|
|
|
so what doesn't work is
std::getline(stream,s);
after the getline, there's nothing in s, i debugged it.
OK, I think I know what's the problem. Does your program by chance read from cin with >> before getting to the getline sentence? If so, what's happening is that getline reads the Enter after the last input and returns (quite correctly) an empty string. You may try this theory by invoking getline twice: if I'm right, the second call will get your actual string.
In case this is the problem, you might want to rethink how you do the input: in general, mixing >> and getline can be a little messy to deal with.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That did it!!
muchas gracias!
|
|
|
|
|
Dear All..
I am going to work on build an SMSC (Short Message Service Centers) application (SMS Connector to GSM Server) and i am new with dealing this subject in vc++, i make my own research on this field but i had good idea about the hole process of SMSC but i still need technical information so if there is any one had been worked on something like that to help me with this application or if anyone know web site i can use to guide me in that i will be grateful..
Best Regards,
Rasha
|
|
|
|
|
ask this on the Mobile/eMbedded forum
TOXCCT >>> GEII power
|
|
|
|
|
|
Ok, this is a bit odd to explain, I am trying to create a dialog class that is essentially modal only, and that is dismissed when the user clicks outside of the dialog window.
Furthermore, this dialog can display subdialogs with these same properties. So clicking outside of all nested dialog will dismiss all of them, while clicking on some parent dialog will only dismiss that dialog's subdialogs.
I am a bit lost of as to how to go about implementing this behavior, I have formulated a couple vague solutions using Hooks, CSubclassWnd, or regular messages. None of these are quite there, I think I am missing some key elements.
Any suggestions as to how one should go about this?
Much appreciation,
Jon
|
|
|
|
|
jonathanleebrown wrote:
I am trying to create a dialog...that is dismissed when the user clicks outside of the dialog window.
Is this really your intent? If so, it goes against how most folks perceive a dialog to behave.
What if someone is filling in the blanks on the dialog, but needs to open up another application to find something?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
This is indeed a valid concern, certainly a impediment to the general applicability of this design.
Though this class has to be general enough to use in a few different contexts, the primary usage is selecting options via listboxes, buttons, etc.
|
|
|
|
|