|
Well, i'm giving up on a project i was supposed to do in LabView (graphical programming) and i'm doing it in good 'ole MFC. I need to know what i should use for a certain display of data. My assumption is a progress control, but there may be something better.
Here is what i want it to look like, roughly: clicky[^]
I'm more interested in the red slider bar than anything. I need a red one and a black one, and i haven't figured out how to change the colors of progress controls in MFC as of yet. Is there an alternative, or should i use the progress control?
*.*
cin >> knowledge;
|
|
|
|
|
Naw, don't use a progress control for something like this - it's far too bloated for what you need. Just draw a simple client-edge static control with some tick marks (if fixed, this is even easier). Then treat the value as a percentage and draw a red or black rectangle in the client edge (taking into account the client edge) that is the same height (or width) of the static control and the percentage of the width (or height) of the static control. This is simple enough and easier to customize (more than likely) than a pre-canned CProgressCtrl class in MFC.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
*jump* *jump*
well, i thought jumping might help me catch the stuff flying over my head. if i understand you corrrectly, you suggested making a static control (like a static text?) and draw a rectangle inside it? Thats a great idea, but what type of static control do i use? :-/
*.*
cin >> knowledge;
|
|
|
|
|
Just a regular static text control??
I think a slider control may be what you want.
John
|
|
|
|
|
No, not even that. You have the overhead of the slider control while trying to override its painting (i.e., owner drawing) anyway. It's pointless.
By static control, I meant CStatic (since you're using MFC). It's a simple control with no frills. You're thinking of the CEdit control (to the original poster). You could even derive from CWnd - you just need a surface to paint on. This is a very simple solution and trying to "extend" some existing control that is "close but no cigar" will just make things worse.
Consider using a slider: sure, it has tick marks - but you don't want the actual slider, right? So you have to go to all the work of either keeping the slider from painting or painting over it. After that, you have to go to the trouble of still painting your simple colored rectangle.
So, just make your own control (say, CGuage that derives, preferrably, from CWnd ) and handle the WM_PAINT message (or use a number of overridables or other forms for owner drawing).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
Consider using a slider: sure, it has tick marks - but you don't want the actual slider, right? So you have to go to all the work of either keeping the slider from painting or painting over it. After that, you have to go to the trouble of still painting your simple colored rectangle.
Yes you do want the slider. You want a disabled range selection slider but without a thumb. But I just look at the code that I was thinking about and it was a complete owner draw (basically a copy of the MFC control with a few modifications) so I guess there is no point to using a slider. I had to use an owner draw slider on a mammography system because the thumb rect was too small on the high resolution monitors (2K by 2.5K resolution).
John
|
|
|
|
|
i think using a progress control qwould be easiest, and i found out how to use SetBkColor. I need to change the slider color tho, not the background color. can this be done? msdn isn't helping much...
*.*
cin >> knowledge;
|
|
|
|
|
welp i solved the problem, i found i can change the slider solor by using progress_control.SendMessage(PBM_SETBARCOLOR,0,RGB(100,100,132)); I don't know how it works, but i know how to change the colors.
thanks for the input you gave me.
*.*
cin >> knowledge;
|
|
|
|
|
|
Hi All,
I'm having a problem creating a custom dialog box. I need to limit the user to only be able to browse the folders below a certain folder.
I'm trying to figure out how to trap the "Button Up" message on the toolbar properly so I can check the next folder going up and therefore prevent the user from going up any more directories. The problem is that no matter what I do, even in processing the up Button message and returning TRUE so the default windows doesn't process the message, the message still gets processed and the user is allowed to go up past my limit.
I tried capturing the last message after the app gets updated, and then revert back to the limit folder, then signaling the window to update again as well. But that still didn't work.
Any ideas? Thanks!
Dan
|
|
|
|
|
You might try the SHBrowserForFolder function instead. It doesn't provide a wrapper class in MFC that I know of, but it's simple enough to use. You can set the root, limit the types of items that can be selected, and even have files show up (despite the function name containing "browse" and "folder") in newer (albeit not so new) function versions using a simple flag.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I'll give that a whirl. Thanks for the suggestion.
probably not quite what I'm looking for but I might be able to make it work.
I'll keep ya posted.
thanks!
|
|
|
|
|
Heath Stewart wrote:
You might try the SHBrowserForFolder function instead
not exactly what I was looking for. I need the same look/feel as the FileOpen Dialog. Thanks for the hint though.
I guess I just need to keep looking. Anyone else have an idea?
|
|
|
|
|
Okay, then there is several options you can do to really fix the CFileDialog . The following alternative uses MFC's CFileDialog (since that seems to be what you want to use), but you could just as easily use the method that it wraps, GetOpenFileName .
First, create an instance of the CFileDialog . When you've done that, get the m_ofn member struct from the instance and perform the following.
- OR the
Flags member of the OPENFILENAME structure with OFN_ENABLEHOOK . You might also want to OR it with OFN_NODEREFERENCELINKS while you're at it to keep users from making a shortcut to a location outside your limited scope.
- Set the
lpfnHook to a HOOKPROC callback.
From there, your options are many. In WM_INITDIALOG , you could simply remove the the "Up" button entirely based by getting the toolbar in which its contained (based, perhaps, on the window class for the toolbar which Spy++ can give you, which is ToolbarWindow32 , or getting it based on the tooltip or some other identifier) or handling the message generated when you click the up button. Spy++ reports this as either WM_USER+300 (aka 1) or WM_USER+302 (aka 2) (both were posted as 1211 (based on aforementioned aliases). What those mean you'll have to dig-up. All the other messages were mostly painting and mouse messages - nothing that would seem to help.
It's surprising that handling the click messages and returning true didn't help. Did you handle WM_LBUTTONUP ? That directory change is triggered then and not during WM_LBUTTONDOWN . Just out of curiosity, how did you determine if the "Up" button was being clicked?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
How does one retrieve the row count in a open IRowset (besides the obvious method of scanning them all)?
Thanks.
Regards,
João Paulo
|
|
|
|
|
I don't think you can. Most recordset implementations I've seen can only give you a rough estimate - guesses basically. On large queries even the DBMS may not even know how much data there is left to scan.
--
Ich, du, sie, er, es, ihr, sie, Sie.
|
|
|
|
|
Thanks, Jörgen. I suspected that... I just wonder how ADO does its RecordCount processing. Most likely, it will scan all rows as I am doing.
Regards,
João Paulo
|
|
|
|
|
João Paulo Figueira wrote:
I just wonder how ADO does its RecordCount processing. Most likely, it will scan all rows as I am doing.
Most likely! ADO is pretty brain dead actually...
--
Ich, du, sie, er, es, ihr, sie, Sie.
|
|
|
|
|
I just found the answer I needed, although it is provider-dependent. SQL Server CE 2.0 exposes a IRowsetPosition interface that will return a count of the number of rows in the rowset (as well as the current position of the cursor).
Regards,
João Paulo
|
|
|
|
|
Ah, ok. SQL Server CE 2.0 can't handle very big amounts of data? There has to be some fixed reasonable limit for which the DBMS can make assumptions about.
--
N = { ni | n0 = 0, ni + 1 = ni + 1, i ³ 0 }
|
|
|
|
|
The DB size limit is 2GB (as well as max table size). Anyway, using this interface is straightforward and does not seem to reduce access speed.
Regards,
João Paulo
|
|
|
|
|
Hello
Does anyone know a way to place a Crystal Report Viewer in the Visual C++ project?
I can't do it But didn't find a statement that it is impossible in the help system.
Thank you in advance
|
|
|
|
|
If you're using managed C++, VS.NET 2003 now has visual Windows Forms designer. Drop it on the form like any other control. If you have VS.NET 2002 and still using managed C++, you can code the control manually. Just instantiate it, set the size and location, and add it to the form's Controls collection.
If you're not using managed code but trying to use the Crystal Report Viewer that comes with VS.NET - it won't work. That's only a managed control. In this case, you'll have to buy Crystal Reports from www.crystaldecisions.com.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
look at craxdrt.dll (I'm assuming you're talking about the ActiveX control). You can instantiate the control as any other AX control and use it.
If I remember correctly, there are samples on how to do this in some samples subdirectory of the Crystal Reports installation.
--
Ich, du, sie, er, es, ihr, sie, Sie.
|
|
|
|
|
Hi,
I would like to make a client/server App using C++ and visual studio.net that run on winXP.
I know that I can use CAsyncSocket and CSocket to create such an App. But I would like to know if it's the best way to do it? Is there other utilities that I can use?
Thanks for helping
Myke
Everything's beautiful if you look at it long enough...
|
|
|
|