According to msdn, http://msdn.microsoft.com/en-us/library/bb774798%28VS.85%29.aspx,
returning TRUE prevents user from editing labels.
So I wrote the code below:
Main:
WinMain(...)
{
DialogBox(..., DlgProc)
}
DlgProc:
DlgProc(...)
{
switch(message) {
case WM_NOTIFY:
if((NMHDR *)lParam->code == LVN_BEGINLABELEDIT) {
return TRUE;
return FALSE;
...
}
Still, the labels can be edited. I dont want to cancel the style LVS_EDITLABELS, because sometimes I would like to allow the users edit labels.
Does anyone know the problem? Thank you.
Returning TRUE from a DialogProc() doesn't mean what you think it does. Quoting from the MSDN library article:
Typically, the dialog box procedure should return TRUE if it processed
the message, and FALSE if it did not. If the dialog box procedure
returns FALSE, the dialog manager performs the default dialog
operation in response to the message.
If the dialog box procedure processes a message that requires a
specific return value, the dialog box procedure should set the desired
return value by calling SetWindowLong(hwndDlg, DWL_MSGRESULT, lResult)
immediately before returning TRUE. Note that you must call
SetWindowLong immediately before returning TRUE; doing so earlier may
result in the DWL_MSGRESULT value being overwritten by a nested dialog
box message.
Related
I'm implementing a simple "track changes" type of interface that replaces deleted content with the same content, but highlighted and with a strike-through line. This works fine for normal content the user deletes, but when undoing an insertion, the delta looks the same as a regular user deletion. Is there any way to determine if the delta was from the undo extension? Or is this fundamentally the wrong approach?
You might want to check the keyboard Module to detect here that an undo command is done and modify the to-be-applied Delta in order to remove its "deleted style".
This pice of code might help you bootstrap your needs:
'undo': {
key: 90,
shortKey: true,
handler: function (range, context) {
// return true to keep normal Quill behaviour
// or else return a new Delta that modify context
console.log(range, context)
return true
}
}
Best
if(!"".equals(MyFrnds.list_Friends))
{
System.out.println("There is friends list");
Actions action= new Actions(driver);
action.contextClick(MyFrnds.list_Friends).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();
System.out.println("My first friend link is opened in new tab and clicking on Show more button if there are more than 12 friends ");
if(!"".equals(MyFrnds.list_Friends))
{
MyFrnds.btn_FrShowmore.click();
}else
{
System.out.println("There are no more than 12 records");
}
}
else
{
System.out.println("There are no friends to display. So clicking on these two links to add friends");
// Right on FITBASE MEMBERS link and open in new tab
Actions action= new Actions(driver);
action.contextClick(MyFrnds.lnk_Fitbasemem).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();
// Right on Social network link and open in new tab
action.contextClick(MyFrnds.lnk_Socialnet).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();
}
In the above code on very first line I gave If condition as (!"".equals(MyFrnds.list_Friends)) but irrespective of the application it goes to first part of the condition even though it doesn't satisfy the first condition. Hence we get error in executing the script. Can anyone suggest what is wrong in the code.
!"".equals(MyFrnds.list_Friends) is true if MyFrnds.list_Friends is not an empty string. For example if MyFrnds.list_Friends is null, the condition would also return true. You may want to perform an additional null check or simply use StringUtils.isNotBlank(MyFrnds.list_Friends).
Java, check whether a string is not null and not empty?
I had a problem of conditioning what I want this MessageBox() to do when a user clicks "Yes" or "No".
Here is my pseudo code show what I mean:
MessageBox(0,"Click \"Yes\" or \"No\".","A MessageBox() Example",4);
if(TheUserClickedYes){
//Do something
}else if(TheUserClickedNo){
// Do Something else
}
The 4 in the last parameter displays "Yes" or "No" buttons. I can get the box to display, but when I try to condition the buttons, I don't know how to do it. I tried to Google it and all that displayed in the results was C++ or C#. I am trying to do it in C. Thank you in advance.
MessageBox will return an integer indicating which button was clicked, in case of success.
Rewrite your code to use the appropriate constants instead of hardcoding numbers:
switch (MessageBox(NULL, TEXT("Click \"Yes\" or \"No\".", TEXT("A MessageBox() Example"), MB_YESNO)) {
case IDYES:
MessageBox(NULL, TEXT("Yes!"), TEXT("Yes"), MB_OK);
break;
case IDNO:
MessageBox(NULL, TEXT("No!"), TEXT("No"), MB_OK);
break;
default:
/* An error occurred. */
}
Always read carefully the documentation of the API you're using before using it.
MessageBox has an integer result which tells about what user clicked.
See documentation for possible return values: http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx
Also, using 4 instead of MB_YESNO is not a very good style.
The ShowDialog method of the PrintDialog class in WPF is declared to return nullable bool (i.e. bool?), which is consistent with the documentation details:
"true if a user clicks Print; false if a user clicks Cancel;
or null if a user closes the dialog box without clicking Print or Cancel." from http://msdn.microsoft.com/en-us/library/system.windows.controls.printdialog.showdialog.aspx
However, in the code below, no matter how I close the dialog, (I tried the X and Alt-F4) I can never make it return null. Unless I press the Print button, it is always false. This is my test code:
PrintDialog pd = new PrintDialog();
bool? result;
result = pd.ShowDialog();
Do you get the same behaviour? Is the documentation wrong or am I misinterpreting it or not testing correctly? Perhaps this is OS related, I am running Windows 7 Enterprise.
Thank you.
L
FlowDocumentReader doesn't have a GoToPage method, but it supports NavigationCommands.GoToPage RoutedUICommand.
How do I send NavigationCommands.GoToPage with parameter (for example: 1) to my FlowDocumentReader from within my code (not using xaml)?
Thanks,
Yariv
Edited:
Thanks! But though I can send the command with your help, I don't get the expected results. This is the code (and I tried to use FirstPage instead of PreviousPage too):
if (NavigationCommands.PreviousPage.CanExecute(null, this) == true)
{
NavigationCommands.PreviousPage.Execute(null, this);
}
Even though the if statement is true and the inner code is being executed, the FlowDocumentReader stays in the last page...
FlowDocumentReader flowDoc;
...
NavigationCommands.GoToPage.Execute("my parameter", flowDoc);