|
I have a class CCustomRadioCtrl which is derived from cbutton with radio button style. using the object of my custom class I can create radio button, I am not able to set the group property of the radio button if I hv more then one radio control, So that one can be selected at a time.
|
|
|
|
|
What do you mean by "not able to set it"? You use something like ::SetWindowLong(hRadioBtn, GWL_STYLE, ::GetWindowLong(hRadioBtn, GWL_STYLE) | WS_GROUP) but it gives you an error code? You can't set the group style in the resource editor? You can set it but it just does not work? If it is the later one, what happens? Is your radio owner-drawn (has the BS_OWNERDRAW) style? If no, then i guess BS_AUTORADIOBUTTON should make it work. If yes, then, since according to the documentation[^] BS_OWNERDRAW can't be combined with anything else, you will have to provide this functionality manually. You can try using CheckRadioButton[^], i don't know if it works for owner-drawn buttons or not. Other than that what you can do i guess is use GetNextWindow[^] to walk the controls around the radio that has been clicked and find the other radios inside the same group and check/uncheck them.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
Can you send me some sample code, please ?
|
|
|
|
|
Of what?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
Hi!
I got the following compiler error.
error C2491: 'CEGUI::IrrlichtRenderer::d_rendererID' : definition of dllimport static data member not allowed
I've not imported any dlls. I've declared the variable "d_rendererID" in the header file as static with a
protected access specifier.
static String d_rendererID;
and I'm defining it in the source file like this:
String IrrlichtRenderer::d_rendererID("CEGUI::IrrlichtRenderer "
"- Official Irrlicht based 2nd generation renderer module.");
What is the thing that prevents the definition of this variable? How do I resolve?
|
|
|
|
|
All error codes can be found on MSDN with a better description -> C2491[^]
What is String? A class or a #define?
#define String __declspec(dllimport) std::string
could result in such error.
|
|
|
|
|
hi i want to open and play a video file in pocket pc 2003 using vc++.
please any idea any sample code which will help me.
|
|
|
|
|
|
Hi!
I got this error when I compile m y project.
error C2664: 'irr::video::ITexture *irr::video::IVideoDriver::addTexture(const irr::core::dimension2d<T> &,const irr::io::path &,irr::video::ECOLOR_FORMAT)' : cannot convert parameter 1 from 'irr::core::dimension2d<T>' to 'const irr::core::dimension2d<T> &'
1> with
1> [
1> T=irr::u32
1> ]
1> and
1> [
1> T=irr::s32
1> ]
1> and
1> [
1> T=irr::u32
1> ]
1> Reason: cannot convert from 'irr::core::dimension2d<T>' to 'const irr::core::dimension2d<T>'
1> with
1> [
1> T=irr::s32
1> ]
1> and
1> [
1> T=irr::u32
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
How do I resolve this error?
|
|
|
|
|
Please don't post the error message as code, it becomes unreadable.
Could you also post some part of the code where the error occured?
By looking at the error, it seems you are trying to pass a dimension2d<u32> to a function accepting a dimension2d<s32>. With template objects, there's no automatic conversion even if a u32 can be converted to a s32 automatically. These templates are two different objects which cannot be interchanged.
You have to work with a dimension2d<s32> instead of a dimension<u32>.
EDIT: fixed the HTML tags
|
|
|
|
|
Here is the line that causes the error.
d_texture = d_driver.addRenderTargetTexture(
irr_sz, IrrlichtTexture::getUniqueName().c_str());
irr_sz is the argument of type
irr::core::dimension2d<irr::s32>
Compiler says can't convert the above type to const irr::core::dimension2d<T>
What to do?
|
|
|
|
|
Sorry, the < and > symbols were removed in my previous reply. This is fixed, and I explained what you have to do.
|
|
|
|
|
I have been asked this question in my recent interview...
"How can we make sure that only one thread access global variable?"
What's the appropriate answer.
Thanks all
|
|
|
|
|
Using "Synchronization".
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
That does not limit the number of threads accessing a variable, it merely sequences the accesses, making sure they don't overlap.
|
|
|
|
|
Of course.
It wasn't clear to me what the interviewer really asked to the OP.
BTW you may use a synchronization object to prevent other threads accessing the resource, if hanging the other threads is an option...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Thursday, June 17, 2010 8:40 AM
|
|
|
|
|
We both read the same sentence, which is pretty clear IMO. I took it as is, you chose to read something that wasn't really there... Hanging is not an option, this ain't 19th century Texas.
|
|
|
|
|
Yes, indeed it was pretty clear and I really chose to read it that way (I've updated my previous reply).
Hanging threads is an everyday option for many 'senior developers' around...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
|
rp_suman wrote: Mutex Objects
Critical section at the time of accessing of the variable! not mutex if we talking about thread! mutex is more beneficial in case of limiting access across different process
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
The first response is to gently chide the interviewer telling him (or her) that they're mad for using global variables in a multi-threaded program.
Once they've made some excuse for using global data (legacy code, have to make change immediately otherwise the four horsemen ride, Jormangand wakes or even worse the company's stock price falls) the second thing to do is turn the question around and ask whether they mean from one thread at a time or only from one thread? If they say from only one thread EVER then say you'd use thread local storage (TLS) or refactor the code to pass the parameter down the call stack from the function the thread started in. If they "from one thread at a time" say you'd use the appropriate type of lock - usually a type of mutex.
The final thing before the interviewer moves on is to ask whether programmers use a lot of globals at this company... If they do consider asking for more money as you'll need it for the extra hours spent debugging gash code (and yes, this is from recent personal experience...)
Cheers,
Ash
|
|
|
|
|
Thanks guys,
Synchronization is what i replied, But as Aescleal get it right the interviewer was asking that the variable must be accessed only and only by one thread.. So i guess the TLS is the answer he wants, I need to see these thing in deep Nevertheless i got the job
|
|
|
|
|
Normally if we have
class A{};
class B : public A{};
int f(A* x){};
B* y;
f(y).
works. However, if B is derived using protected from A, the code doesn't work anymore. Is there any way to get around this without changing protected back to public?
|
|
|
|
|
Since the base class is protected, none of the members of the base class can be accessed using its object or pointer.
All access will only be possible withing the class itself.
So you will not be able to access any members of the class using the x pointer.
|
|
|
|