Infolog with large amount of messages - microsoft-dynamics

I am having an issue using Dynamics Ax 2012 Enterprise Portal where I am displaying every validation error in the infolog to a custom page in a modal dialog. If there are many errors, the infolog will place itself above the page, and I have to click and drag text to force the window to scroll up and see the errors. What can I do about big infologs?

I have found out how to add a scroll bar to the infolog.
The div containing the infolog has the class dynInfologOuter. If you edit the AXEP.css file to add:
max-height: 120px;
overflow-y: scroll;
... to the .dynInfologOuter css class, the infolog will add the scrollbar and display all the error messages in that height, and the 110px allows for 5 errors to show up.
This, however, will change the infologs everywhere in Enterprise Portal, which isn't necessarily a bad thing to have them all like this.

Related

PrintPreviewDialog issue on 4K monitor

I have added a print preview feature to my program. The problem is, it does not display the preview document well on screen resolutions above 1920 x 1080.
Example:
Code:
QFont docFont;
docFont.setPointSize(14);
QTextDocument *textDoc = new QTextDocument(this);
textDoc->setDefaultFont(docFont);
textDoc->setPlainText(getHardwareData());
During a debugging process I have found the following issues:
QWindowsMultiFontEngine::loadEngine: CreateFontFromLOGFONT failed for "Courier": error 0x88985002 : Indicates the specified font does not exist.
QWindowsMultiFontEngine::loadEngine: CreateFontFromLOGFONT failed for "Courier": error 0x88985002 : Indicates the specified font does not exist.
Is there any hint/font to make it look well on all screens resolutions?
Edited:
I have fixed the QWindowsMultiFontEngine::loadEngine: CreateFontFromLOGFONT failed for "Courier" issue. The problem was caused by a Unicode character in Peripheral data. Now, the only thing left is to make it look better on 4K.
I have found some hack to get the toolbar actions from a print preview dialog. By adding some additional logic it fixed the issue.
QList<QToolBar*> toolbarList = printPreviewDlg->findChildren<QToolBar*>();
if (!toolbarList.isEmpty()) {
if (screenSize.width() > 1920 && screenSize.height() > 1080) {
toolbarList.first()->actions().at(0)->activate(QAction::Trigger);
} else {
toolbarList.first()->actions().at(1)->activate(QAction::Trigger);
}
}
To detect the screen size I use the native Win API methods. Now, it automatically triggers the Fit to width toolbar option and sets a better preview on 4K monitor. It works depending on the screen size. The issue is resolved.

How to Change QMessageBox Icon and Title

I am creating a ui app with Qt c++.
I have a error message that I have created by using QMessageBox Class like :
QMessageBox errorMessage;
errorMessage.critical(0, "Error", "An error has occured !");
errorMessage.setFixedSize(500, 200);
It is like:
And I want to change the red circled things which are the icon and the title.
I would appreciate any help.
Thanks in advance.
However you can use of QMessageBox::critical(0, "Error", "An error has occured !"); because critical(...) method is static and theres no need for create an instance of QMessageBox.
Use bellow code :
QMessageBox mb("Application Name",
"Hardware failure.\n\nDisk error detected\nDo you want to stop?",
QMessageBox::NoIcon,
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::NoButton,
QMessageBox::NoButton);
QPixmap exportSuccess("/media/msi/Information/Pictures/Icons/Icons Pack/PNG/48X48/about.png");
mb.setIconPixmap(exportSuccess);
mb.exec();
This example work 100%
If you want to set the icon for every window you can do so globally with this:
QApplication::setWindowIcon(QIcon(":/GuiMain/gh_resource/GH Icon.ico"));
You also aren't required to use pixmap in my experience, you can use:
mb.setWindowIcon(QIcon(":/path/to/icon.ico"));
This will work on individual message boxes, just add your custom icon to your .qrc file
Simply you can set Icon for your Application it will automatically set on your MessegeBox

Touch Up Inside event not working after rotation of tab bar

I have a button in one of view controller of tab bar controller. All set up in storyboard. I registered action method like this
- (IBAction)buttonPressed:(id)sender {
NSLog(#"Button pressed");
}
The thing is that once I make left and top constraints (to force it stay in the right upper corner) touch up inside event stops working after I change rotation. So just open app in portrait mode - method is working. Change to landscape and I cannot tap button suddenly.
I've recreated problem in this easy example project.
Many thanks.
Just put the following code in you TabBarViewController class.
- (void)viewDidLayoutSubviews
{
// fix for iOS7 bug in UITabBarController
self.selectedViewController.view.superview.frame = self.view.bounds;
}
Recently I noticed same bug in my application. First I tried Slavco Petkovski method. But this caused me another bug with rotating and getting right bounds and frame, so I kept searching.
I found another solution for this problem, mainly setting autoresizing mask of view controller's view in xib. But since arrows in inspector in my Xcode (version 5.0.1) are inactive and you can't set them, you have to open xib file in text editor find autoresizingMask property for main view and change it like this:
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
EDIT:
Alternatively you can do this in your view controller's code - same result as in changes in xcode:
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

How might I obtain the IContextMenu that is displayed in an IShellView context menu?

Building a file open dialog replacement. Much of it works now, but I would like to generate the view-mode drop-down for the toolbar directly from the shell view object.
Looking at IShellView2, I can see IShellView2::GetView() will give me the FOLDERVIEWMODE's supported. However, that doesn't give me the names of these modes, nor format that popup menu for me, nor immediately give me a way to actually set one of those modes (it would appear it is necessary to destroy the shell view window and create a replacement one for the current folder and specify the new FOLDERVIEWMODE desired... yeesh).
At any rate, if one right clicks on an IShellView window, one gets a context menu, the first submenu of which is exactly what I want to place in my drop-down toolbar button (ie. the "view" fly-out menu (e.g. Small Icons, Medium Icons, etc.)).
It seems like there ought to be a way to grab that submenu directly from the IShellView, rather than having to hardcode my values (and that way, if a given instance of IShellView supports extra view modes, they'd be there. Similarly, those which should be disabled would be, since it would all be under the IShellView's control).
I have read Raymond Chen's excellent How to host an IContextMenu. Unfortunately, that just gives me a very simplistic context menu - the one for the folder itself, or for a file in a given folder, but NOT the context menu for the IShellView's shell view window (from which I might obtain the view fly-out).
I have tried the following, based on Chen's article:
CComQIPtr<IContextMenu> pcm(m_shell_view); // <<-- FAIL resulting pointer is NULL <<<
// create a blank menu
CMenu menu;
if (!menu.CreatePopupMenu())
throw CContextException("Unable to create an empty menu in which to store the context menu: ");
// obtain the full popup menu we need
if (FAILED(m_hresult = pcm->QueryContextMenu(menu, 0, SCRATCH_QCM_FIRST, SCRATCH_QCM_LAST, CMF_NORMAL)))
throw CLabeledException("Unable to query the context menu for the current folder");
// display the menu to the user
// menu.getsubmenu
::TrackPopupMenu(menu, ::GetSystemMetrics(SM_MENUDROPALIGNMENT)|TPM_TOPALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0, m_shell_view_hwnd, NULL);
Unfortunately, the attempt to query the m_shell_view (which is an IShellView*) for its IContextMenu interface fails. This "works":
// retrieve our current folder's PIDL
PidlUtils::Pidl pidl(m_folder);
// get the context menu for the current folder
CComPtr<IContextMenu> pcm;
if (FAILED(m_hresult = GetUIObjectOf(m_owner->m_hWnd, pidl, IID_PPV_ARGS(&pcm))))
throw CLabeledException("Unable to obtain the PIDL for the current folder");
But here I get only a very few options in the context menu (Open, Explore, ...). Not the detailed context menu that I get if I simply right click on the shell view itself.
I'm out of ideas as to how to proceed. Help?! ;)
Try IShellView::GetItemObject with SVGIO_BACKGROUND as uItem to get a IContextMenu on the view object : http://msdn.microsoft.com/en-us/library/bb774832%28VS.85%29.aspx
There is the SHCreateDefaultContextMenu (Vista an up) that may be of help. Bjarke Viksoe website contains great info as well.
SVGIO_BACKGROUND will get you the background context menu of the shell view. You may need to call repeatedly pShellView->SelectItem for each PIDL you may have, then do the GetUIObjectOf call (then QI for IContextMenu, create a menu, call IContextMenu(3)::QueryContextMenu and finally display it with TrackPopupMenu).

Help getting QTP to identify a control

We're trying to use QTP (QuickTest Professional) to auto-test a legacy C++ application.
However, the main window for the app is composed of several IDENTICAL panels. Each panel has a unique title.
If I view the window in Spy++ (comes with DevStudio), I see:
+ Window <hwnd> "Window Title" taskwindowclass
+ Window <hwnd> "Panel A" childwindowclass
+ Window <hwnd> "OK" Button
+ Window <hwnd> "Panel B" childwindowclass
+ Window <hwnd> "OK" Button
In QTP's Object Spy however, the hierarchy shows as:
+ Window: Window Title
+ WinButton: OK
It doesn't even show that there is an intermediate panel.
Does anybody know a way to get the window "path" in order to identify each control?
i.e. so the controls identify as:
Button A: "Window Title/Panel A/OK"
Button B: "Window Title/Panel B/OK"
You could use descriptive programming to bypass the object map. QTP will ignore panel objects by default. You could try to get a reference to the panel object dynamically, then search the ChildObjects collection to find the ok button. Another option might be to simply add an ordinal identifier to the ok buttons.
Button A: "Window Title/OK index #1"
Button B: "Window Title/OK index #2"