|
Has your dialog the top most status (e.g. by calling SetWindowPos with HWND_TOPMOST or setting the WS_EX_TOPMOST style)?
Then change that.
|
|
|
|
|
The only call with SetWindowPos is
SetWindowPos(
FindWindow(_T("Shell_TrayWnd"), _T("")),
m_nStartPosX,
m_nStartPosY,
rc.Width(),
rc.Height(),
SWP_NOOWNERZORDER | SWP_NOACTIVATE);
inside of CAlertDialog ... I don't think this call is the issue ...
|
|
|
|
|
But you gave an idea:
m_ToolTip.Create(this, TTS_ALWAYSTIP | TTS_NOPREFIX);
m_ToolTip.AddTool(GetDlgItem(IDCANCEL), _T("Bla bla bla"));
m_ToolTip.Activate(TRUE);
m_ToolTip.SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE);
I don't know if it's all right, but seem to work ... Thank you !!!
|
|
|
|
|
I was just going to suggest removing SWP_NOOWNERZORDER .
However, fine to hear that it seems to be solved.
|
|
|
|
|
Still, I will try your suggestion ... I'll come back.
|
|
|
|
|
Yep, I removed SWP_NOOWNERZORDER flag, and everything seem to be all right now, without m_ToolTip.SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE); ... so, it is better solution ! Thank you again ! 
|
|
|
|
|
Hi Johen. After all, I can not give up SWP_NOOWNERZORDER flag ... It should be there, but I want to ask you what is the best solution to put tooltip above CDialog which has SWP_NOOWNERZORDER flag:
SetWindowPos(
FindWindow(_T("Shell_TrayWnd"), _T("")),
m_nStartPosX,
m_nStartPosY,
rc.Width(),
rc.Height(),
SWP_NOOWNERZORDER | SWP_NOACTIVATE);
the solution was the following:
BOOL CNotifyDlg::OnInitDialog()
{
CAlertDialog::OnInitDialog();
m_ToolTip.Create(this, TTS_ALWAYSTIP | TTS_NOPREFIX);
m_ToolTip.AddTool(GetDlgItem(IDCANCEL), _T("Close this notification"));
m_ToolTip.Activate(TRUE);
m_ToolTip.SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOOWNERZORDER | SWP_NOSIZE);
return TRUE;
}
It is ok ? To be frank, I don't like idea to setup tooltip as top level window ... there is another solution ?
Flaviu.
|
|
|
|
|
A tooltip should be a top level window to ensure that it is visible. It is only shown when requested by the user and closed when clicking anywhere with the mouse. So it does not interfere with other GUI elements. If you have a working solution I would stay with that.
|
|
|
|
|
Ok, I will. It is always a pleasure to talk with you. Thank you for sharing your experience !
|
|
|
|
|
I really do not know where to post this and I hope I can explain my question , so be gentle.
I am using SAM3x8e hardware timer (TC3) as an interrupt.
The “TC3_Handler” (callback?) global function name is “hardcoded” somewhere and fires as expected at desired intervals.
I do some verification of this by outputting simple message to LCD.
The LCD “class” is declared / instantiated as a global class to the entire application and works amicably.
Simple “lcd.print(“OK”)” is executed just fine in the TC3 handler.
I also do some hardware output – turn on / off LED – just for an additional indication the handler is being executed.
Now I want to execute a method / function of ANOTHER globally defined / instantiated class, again in same TC3 handler.
Adding cpal.Run(); did not compile – undefined “cpal”.
I had to ADD extern CPAL cpal; so it would compile and execute cpal.Run();
My question is
both LCD and CPAL classes are global, the LCD can be used OK, but the CPAL has to have the extern “reference” added into the TC3 handler. Why?
Thanks for reading, appreciate any help.
Cheers
Vaclav
|
|
|
|
|
Probably because LCD global object is declared extern in one of the headers included by your source file containing the TC3 handler.
|
|
|
|
|
Thanks,
makes perfect sense.
I am not sure I'll spent time to actually look for such declaration, but I need to learn more about hardware interrupts so maybe I'll run into it sooner or later.
Thanks again.
Vaclav
|
|
|
|
|
|
I need opinions on code like this:
"if ((++(m_pLF->m_iLogCnt)) >= MSG_QUEUE_FILE_SIZE)"
maybe it's just me and my past - I was taught never to depend on order of operations. This is handled with the parenthesis , but really, should it be that hard to analyze an IF statement?
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
That's not terribly complex, but did you really need it that way?
|
|
|
|
|
No, that one was not terribly complex, and I also selectively edited it.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Obfuscation is the best way to annoy those who have to maintain your code.
|
|
|
|
|
You know, it's one thing to obfuscate, it's another to code in such a style as approaching enemy action. It's hard enough to write clear code. The style of code I posted just seems easy to break and difficult to debug. The debugger is going to treat that like one line of code.
Caveat: I freely admit that I choose to restrict how much code I put on a line. I like using ternary or conditional operator as it can make things much cleaner, as long as you don't get silly with it.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Absolutely agree with you. Most of the time code like that is done by people who don't know any better (copied it from the internet), or who think they are so damn clever.
|
|
|
|
|
Well, I know who wrote the code - I'll go with clever. Bright individual, I just wanted to make sure it wasn't just me.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
This is not too complex, but at the limit where I would consider breaking it up into multiple statements.
That said, if that were a while condition, I might be more inclined to leave it like that, because (a) the increment might be considered part of the loop iteration, and (b) moving part of the condition might require more than one additional line (e. g. once before the start of the loop and once inside).
Apart from that, I am more bothered with the naming
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
I am going crazy over this simple test code.
char *Result ={"Result init "};
char *Source = {"123"};
char *Destination = {"456"};
I can verify that all strings are as initialized.
Now I run this strcpy
Result = strcpy(Source,Destination);
Now I can verify, using same approach as before , that
Result = 123 - AKA orignal Source, it was Result init before strcpy was run.
and Source is STILL 123 .
Result suppose to be Source ( source destination swap) , but I expect the Source to be COPY of the original Destination AKA 456
What am I doing wrong?
strcpy executes giving correct return, but unmodified Destination.
Am I doing the initialization correctly?
Am I nuts?
Standard stdio using GCC compiler /tools on Arduino IDE.
Thank for your help.
Vaclav
modified 3-Aug-15 22:30pm.
|
|
|
|
|
I think you have the parameter names backward so it's confusing to me.
After the strcpy, Result and Source should contain the same address, the value there should be 465, and the value at Destination should also be 456.
Is that what you see? Is that not what you want?
Be aware that you are not implementing a "swap" at all.
Unless there are other concerns, if you want to "swap" then swap the pointers, not the values:
Result = Destination;
Destination = Source;
Source = Result;
modified 3-Aug-15 23:29pm.
|
|
|
|
|
It should not work at all. String constants declared as above are read-only, so you should not be able to use strcpy to overwrite one of them by another. When I try it I get an access violation on the write, as I would expect. I am not sure why your system does not give the fault, maybe a peculiarity of Arduino. But since strcpy is supposed to return the pointer to the destination field, Result will now point to the data that Source points to, i.e. "123", but the original data should be untouched.
|
|
|
|
|
You cannot do that, it is a mistake. Your variables point to statically allocated (i.e. constant) strings you must NOT try to change.
The following program
#include <stdio.h>
#include <string.h>
int main()
{
char Result[] ="Result init ";
char Source[] = "123";
char Destination[] = "456";
strcpy(Destination, Source);
printf("%s %s\n", Destination, Source);
return 0;
}
on the other hand, outputs
123 123
Please note, parameter order in strcpy is important (like in any other C function, after all).
|
|
|
|
|