|
I'm pretty new at C++ so please bear with me. I currently have two spin controls, both aligned horizontally, and they are fully functional within the context of my app. The problem is they could be more intuitive, see currently it's laid out something like this:
X Position:
<< >>
Y Position:
<< >>
but what I'd rather see is something more like:
^
^
<< >>
v
v
so that X/Y motion is being controlled by arrows pointing up/down/left/right rather than left/right controlling both X and Y motion.
How can I go about creating a 4-direction spin control?
thanks
-Paul
|
|
|
|
|
A spin control either has the UDS_HORZ style or it doesn't. Without it, the style is vertical (i.e., up and down).
It almost sounds like you need a button where, when clicked, you can detect where the clicked happened and act accordingly. You might want to break the button up into nine quadrants:
---+-+---
|NW|N|NE|
---+-+---
|W | | E|
---+-+---
|SW|S|SE|
---+-+--- Another idea would be to use two slider controls: one with the TBS_HORZ style and one with the TBS_VERT style.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
>>A spin control either has the UDS_HORZ style or it doesn't. Without it, the style is vertical (i.e., up and down).
true. and so for example, at the moment, I have my Y control not specifying the UDS_HORZ style, and so it is placed vertically, the X control does specify that and so it is placed horizontally.. but of course they do not overlap, it'd be nice if they could intersect in the center. my app is already working with the spin controls' internal deltapos tracking mechanism, so to create a custom button would require re-working all of that. A button with quadrants like you described would be useful as well, I'd have to put graphics (large arrows) into each quadrant.. I just have never developed a custom control and don't even know where to begin
|
|
|
|
|
mound wrote:
I just have never developed a custom control and don't even know where to begin
Here is a starting point. Note that the URL is temporary.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
That's pretty cool. I actually went ahead and created what I needed using multiple buttons (I used the CButtonST control available on this site.) -my control needs rollover and down-states for each of the arrows, and it's actually a bit more complex than purely North,South,East,West - Each direction actually has a big arrow, and a smaller arrow underneath it, both pointing the same direction, the bigger arrow controlling motion by a larger offset than the smaller arrow.. It works, but there are alot of buttons required and I have to tweak the positioning of the standard pushbutton controls on the dialog editor pixel by pixel to make the rendered graphical "widget" pieces all line up properly.. It does work, it works well in fact, but it feels like it could be wrapped up into one control.. Should I be doing something more along the lines of what you did, using mouse coordinates like a map, swapping different versions of the entire bitmap into place for the rollover state of each of the 8 arrows?
|
|
|
|
|
mound wrote:
Should I be doing something more along the lines of what you did, using mouse coordinates like a map, swapping different versions of the entire bitmap into place for the rollover state of each of the 8 arrows?
That's the question that .dan.g. asked. I'm sure it's possible, but not being a full-fledged GUI person, I'm not sure how to go about it.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
How can I programmatically launch "My Computer", "Control Panel", etc? Thanks.
|
|
|
|
|
=[ Abin ]= wrote:
How can I programmatically launch "My Computer"...
Search for namespace extensions. It's a shell thing.
=[ Abin ]= wrote:
..."Control Panel"
Run control.exe.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
windows shell scripting may help u ,but i dont know to code it
|
|
|
|
|
Hi all I using MSComm to send ASCII characters to a robot. The robot uses 7 bit ASCII and a char is 8 bit. I have set up MSComm to transmit 7 bit ASCII. Which bit is dropped when MSComm converts from 8 to 7 bits?
Thank you
Ketil
|
|
|
|
|
Most Significant Bit is dropped naturally
|
|
|
|
|
thank you thats put my mind at rest
|
|
|
|
|
Hi! I want to know how to get current Identity. I need to know which of wab or OE identities are currently in use. Strange thing is that i can retrive WAB entries on allready logon client but i don't know who he is.
Probably this function will return such string {C9DB85FC-7CA3-4CE7-850B-81F9B94CCD14} which what im looking for
Pain is a weakness living the body
|
|
|
|
|
I'm not sure exactly what you are after, so let me start here. If you know the account name and want the SID, use LookupAccountName() . if you know the SID and want the account name, use LookupAccountSid() . Am I way off?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
VS.Net 2003/Visual C++.Net
MFC
Windows 2000
I have a CTreeCtrl in a dialog box (created programmatically, not from a resource). Even though I specify the WS_EX_CLIENTEDGE extended style, the tree control is inially displayed without a border, and without any kind of 3D appearance.
HOWEVER...
If I expand the tree items to the point that either a horizontal or vertical scrollbar is displayed, the 3D appearnce magically appears, and does not go away as long as the property sheet is displayed.
Anyone got any hints?
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What if you force the control to repaint?
Ant.
|
|
|
|
|
Tried that.
And I tried setting the normal windows styles (in addition to and instead of the extended styles) as well.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote:
If I expand the tree items to the point that either a horizontal or vertical scrollbar is displayed, the 3D appearnce magically appears
That sounds like the non-client area isn't getting calculated or painted properly. When the scrollbars are added, they go in the non-client area and force a recalc/repaint, which also makes the border appear.
Try calling:
tree.SetWindowPos ( NULL, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED ); SWP_FRAMECHANGED is the important flag, that will make the control recalc its non-client area.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
I even hear the Windows "OMG I booted up fine" sound.
-- Paul Watson diagnosing hardware problems.
|
|
|
|
|
You, sir, are a god. That did it.
I tried MoveWindow earlier, but neglected to include that flag.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
Hi !! I'm programming in MFC. I want a CStatic label control to have font color at red. I don't know how to do it, because I'm using this code:
CFont* my_font = new CFont;
my_font->CreateFont(here all the parameters that I need...);
but I can't see anything for the color... What can I do ?? I think that I've to do something with CDC or something... but please, if you could show an example...
Thanks in advance !!
|
|
|
|
|
Yes you have to use CPen pen(..) and then pDC->SelectObject(pen);
don't forget to free resorces DeleteObject(pen)
because after some time our application my behave in funy way
Pain is a weakness living the body
|
|
|
|
|
CPen is for line drawing. You need to use CDC::SetTextColor(COLORREF) to choose what colour the text gets drawn in.
Roger Allen - Sonork 100.10016
Strong Sad: I am sad I am flying
Who is your favorite Strong?
|
|
|
|
|
Rafael Fernández López wrote:
but I can't see anything for the color...
Thats because the control's font has nothing to do with the colour being displayed.
One method that I use is to implement the WM_CTLCOLOR message handler, and set the draw colour (SetTextColor()) for all or individual static control.
Or you can use a derived label class like this: CLabel[^].
I Dream of Absolute Zero
|
|
|
|
|
Does anyone have a tutorial about adding C++ (Visual Studio) code as a macro in Excel. Need to know this for some job interviews. Thanks
|
|
|
|