|
Thanks...will give it a look
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Thanks for the links!
I decided to follow them, and whadayaknow, I learned about the Observer pattern. And they say you can't teach an old dog new tricks. I guess I do my best learning when I'm not forcing myself to learn something.
It's a nice pattern. I'm trying to remember if I've ever used it without being aware of its name, and no, I can't say I have. It's usually a lot simpler and more efficient to link classes directly. Still, I really liked that 1st implementation you gave. I'll keep it in mind for future projects.
Say, what other patterns do you readily use? I know there's lots of them, but what else besides Singleton and Observer do you use on a regular basis?
Thanks again,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
|
Thanks I will look it over.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
And don't forget http://sigslot.sourceforge.net[^]
It's a real easy implementation since it's only a single header file. I'm going to write an article about it sometime.
Joel Lucsy
|
|
|
|
|
Hi Joel,
Thanks for that. I hadn't heard of this before. I will read about it with interest. If you've used boost or libsigc++ I'd be interested in any comparisons you'd care to make. So far I've only used libsigc++
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Comparisons:
sigslot does not do return values (although I have a hacked version that does) while the others do.
sigslot (by default, can turn off) is multi-threaded aware, but I'm not sure about the others. My memory is telling me they aren't, but I could be mistaken.
sigslot is a single .h file, no .cpp's or libs involved. (Mmmm..., templates!)
siglslot does not allow connecting to a function that is not a method of a class. Some may think is a "good thing"tm
if you have a signal with 10 slot connected, all 10 will be called, you cannot abort the sequence early. I know boost allows this thru it's iterator interface, can't recall in libsig++ allows it.
The rest of differences are mostly syntactical.
Joel Lucsy
|
|
|
|
|
I would like to know how to get the printer margins (the dimension of the page) when I'm in the "print preview view".
Thx if you can help me,
-- BUM --
|
|
|
|
|
CPoint ptPhysicalOffset (
::GetDeviceCaps (hDC, PHYSICALOFFSETX),
::GetDeviceCaps (hDC, PHYSICALOFFSETY)
);
CSize sizePhysical (
::GetDeviceCaps (hDC, PHYSICALWIDTH),
::GetDeviceCaps (hDC, PHYSICALHEIGHT)
);
CSize sizeDrawing (
::GetDeviceCaps (hDC, HORZRES),
::GetDeviceCaps (hDC, VERTRES)
);
The physical offset is the left and top margin.
The physical size is the total size of the page.
The drawing size is the size of the area you can draw in.
Thus, the right margin is sizePhysical .cx - sizeDrawing .cx - ptPhysicalOffset .x.
The bottom margin is computed the same way.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim
Thank you it's okay for real printing.
- ptPhysicalOffset = 49x43;
- sizePhysical = 2976x4209;
- sizeDrawing = 2879x4066 with my Canon
But when I show the window "print preview" (in the screen DC)
- ptPhysicalOffset = 0x0;
- sizePhysical = 0x0;
- sizeDrawing = monitor resolution (1600x1200);
So I don't know how big to draw the image I want to print.
For now, I use "pDC->GetClipBox(rcClipBox)" to get the size of the drawing area, but it work only if the preview window is in front of all other windows.
So I wanna find an better method.
Any idea ??
|
|
|
|
|
Hello,
I wanna know if its possible to remove or disable the close button of floating dialogbars.
If its not possible, is anyone know which event is call when I click on this button ?
I've try the WM_CLOSE and WM_DESTROY but its not those events.
Thanks in advance,
-- BUM --
PS: an image of the button I want to remove:
http://epsilon3.dyndns.org/dialogbar.jpg[^]
|
|
|
|
|
bumper wrote:
I wanna know if its possible to remove or disable the close button of floating dialogbars.
Yes, thats possible. Get the handle of the system menu of your floating dialog bar and remove the close button using the RemoveMenu function (SC_CLOSE is the item you want, MF_BYCOMMAND).
bumper wrote:
is anyone know which event is call when I click on this button ?
WM_SYSCOMMAND is sent.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Thank you Dominik, but yours ideas don't work in my application.
In the first case, I get an assertion in afxwin1.inl
<br />
if (!m_wndLayersDlgBar.Create(this, IDD_LAYERS, CBRS_LEFT|CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_SIZE_DYNAMIC, IDD_LAYERS))<br />
{<br />
TRACE0("Failed to create DlgBar\n");<br />
return -1;
}<br />
<br />
m_wndLayersDlgBar.EnableDocking(0);<br />
m_wndLayersDlgBar.SetWindowText("Gestionnaire de calques");<br />
FloatControlBar(&m_wndLayersDlgBar, g_ptWindowLayersOffset);<br />
<br />
<br />
CMenu* pMenu = m_wndLayersDlgBar.GetMenu();<br />
pMenu->RemoveMenu(SC_CLOSE, MF_BYCOMMAND);
wndLayersDlgBar is a CLayersDlgBar which is a CDialogBar
And with the second case, i've put the correct method in my class but the program never go in this method, even when I close the entire application.
<br />
void CLayersDlgBar::OnSysCommand(UINT nID, LPARAM lParam)<br />
{<br />
CDialogBar::OnSysCommand(nID, lParam);
}<br />
Any idea ?
|
|
|
|
|
Add MF_GRAYED to function ModifyMenu().
ModifyMenu(SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
Kuphryn
|
|
|
|
|
I finally find it!
http://www.codeguru.com/mfc/comments/11651.shtml
|
|
|
|
|
hi Im new to programming - Im enrolled in gameinstitute.com taking the intro to c++
We worked with a sample that converted celsius to fahrenheit and I played with it successfully to make it do the reverse (which may seem teeny but sure felt good when I got it hehe)
Now Im trying to add a loop that will convert the answer into increments of 1-5 degrees higher and lower.
The text / class didnt really cover how to work with a loop when the start point of the loop is always different? Im not even sure if that would be right to say this way - how do i insert a loop with a variable of a float?
the code that produces the answer is :
float Fahrenheit2Celsius(float celsius)
{
return celsius * (9.0f / 5.0f) + 32.0f;
}
//celsius = (fahrenheit-32)*(5/9);
//fahrenheit = celsius*(9/5) + 32;
void DisplayOutput(float f, float c)
{
cout << f << " degrees Celsius is " << c << " Celisus" << endl;
}
Im really lost as to how to use a loop to do the requested outcome: the result with 5 degrees higher listed and 5 lower listed
the loop code thats shown in my text for a for loop is :
for (int i=0; i<10; i++)
{
cout<
|
|
|
|
|
I'm not sure how you want your output to look, but I recommend you keep reading about loops. There are 3 types: for , while , and do-while . The for loop is just a fancy while loop, designed to make it convenient to initialize a variable, check if it has reached a certain value, use it (inside the loop), and then increment/decrement its value. For your case, a while loop may be more appropriate.
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
try this:
float deg_f = YourInitialValue - 5.0;
float final_value = YourInitialValue + 5.0;
do
{
DisplayOutput(deg_f, Fahrenheit2Celsius(deg_f));
deg_f += 1.0;
} while(deg_f < final_value);
Hope that helps.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I am adding a class called CImageButton derived from CButton (from CP) to my project. Whne I put a btn on the formview I want the class wizard to give me two choices for type: normal CButon, or the newly added CImageButton. I have a #include for the .h of the added class. But when I go to make a variable for a normal button, it doesnt give me the two choices.
However in the CP demo, they have the button stuff in the grey areas which class wizard works in, and all the necessary tie ins are done etc. So I dont think I can just go and fiddle with the code in the gray area. Right now it reads CButton b1, but I need it to be CImageButton b1; and it should respond just like a regular button on clicking etc...
Appreciate your help,
ns
In the CP demo the class wzd does give me two choices for button type, but if I make a new prj with the two src files in it, it doesnt....
|
|
|
|
|
I think you could try to delete (or change name, it's better ) the .clw file from your project (info for class Wizzard). So, when you open class wizzard again, it won't find the file and ask you to rebuild it from files. Say yes and you will have the choice to select the files from wich it will be build. Don't forget to also select the header and .cpp files from your class !
This should work!
|
|
|
|
|
Hi,
I have seen several code samples for how to setCheckedItems, but I can't seem to find how to getCheckedItems().
This is my setChecked function:
void CMainFrame::SetChecked(int boxNumber, BOOL val)
{
char set = 0;
if( val )
set = 1;
this->m_szChecked[ boxNumber ] = set;
}
Please let me know you know anything about this.
I would appreciate it.
|
|
|
|
|
Does anyone have any idea in ADO how to recover a dropped oracle connection, i have tried every possible combination of disconnect - connect i can think of, I am using oracle 8i, with ado 2.6. If my app is restarted the connection comes back without any problems. Any insights on what it takes to get that connection back???
|
|
|
|
|
I'm not sure why you can't reconnect. What you're doing should probably work...
However, I recommend you take advantage of ADO's connection pooling to make better use of your connection accross different apps, web pages, etc. In such a case, every time you need to run a query (or a series of queries), you open the connection, run the query, and close the connection immediately. If you use this scheme, you'll never have to worry about your connection timing out or being dropped.
Another option is to change the timeout period of your connection to a much larger interval of time. This basically just delays when the problem occurs, rather than getting rid of it, so it's not a really a good solution.
I wish I had an answer to your problem, but you may want to spend a little time trying out the connection pool scheme. It requires that you write a little bit more code, but in the long run it's a better way to share limited resources, such as database connections.
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Connection Pooling is in use but thank you for the suggestion
|
|
|
|
|
Does anyone have any idea in ADO how to recover a dropped oracle connection, i have tried every possible combination of disconnect - connect i can think of, I am using oracle 8i, with ado 2.6. If my app is restarted the connection comes back without any problems. Any insights on what it takes to get that connection back???
|
|
|
|
|