Word Document in QAxWidget doesn't have scrollbars - c++

I'm displaying a word document in QAxWidget.
QAxWidget *axWidget = new QAxWidget;
axWidget->setControl(changelogTempFile->fileName());
axWidget->setFixedSize(400,300);
axWidget->show();
However eventough the whole document does not fit in the viewport I have no scrollbars.
I even tried to use Frameset object to explicitly add scrollbars but it was in vain.
QAxObject *frame = ui->axW_singleChl_doc->querySubObject("Frameset");
if( frame )
frame->setProperty("FrameScrollbarType","wdScrollBarTypeYes");
I received following error message:
QAxBase: Error calling IDispatch member Frameset: Exception thrown by server
Code : 6027
Source : Microsoft Word
Description: Die Eigenschaft Document.Frameset ist nur verf?gbar, wenn Document.Type WdFrameset entspricht
Help : wdmain11.chm [25507]
Connect to the exception(int,QString,QString,QString) signal to catch this exception
Description translated means, that property Document.Frameset is only available if Document.type is WdFrameSet
How can this be achieved? Many thanks in advance,
James

Related

How to center align my display only item in Oracle APEX

I have display only item -> where I am printing error message of database with error code
Following is the name of my display only item : P1_NEW
My code :
Exception
when others then
v_code := SQLCODE;
v_errm := SQLERRM;
:P1_NEW := '<h1 style="text-align:center"> Database error occured </h1>' v_code || v_errm ;
But the issue here is my error code and error message not getting center align
Only my Database error occurred is getting center align
My need is to center align my custom text + error code + error message
Displaying some information to the user as part of a page but not as part of a form can be done with a region as well. Create a region of type "static" and reference your item with the &ITEM. syntax. This gives you a lot more control over the look and feel of the message.

How do I add validation to text area in oracle apex

I am feed up with this Oracle APEX application , their is no proper videos or documentation
I have a Text area field and button
On button click I have written a PL/SQL code to send mail
Is their any way I can populate error / success message on screen
If text area is empty does not have any data then display error message on screen as Text area field is empty
My code :
BEGIN
if (:textarea1 is not null ) then
APEX_MAIL.SEND(p_from => 'alice#example.com',
p_to => 'bob#example.com',
p_subj => 'Email from Oracle Autonomous Database',
p_body => 'Sent using APEX_MAIL');
else
--popup error message on my screen -> `textarea` filed cannot be empty
end if;
END;
The following package of ADD_ERROR.ADD_ERROR does not exist at my end
If text area is empty does not have any data then display error message on screen
You don't need your own validation for that; just set that item's Value required property ON.
Additionally, you can even set process' Server side condition to
When button pressed: pick the button you use to send an e-mail
Type: Item is not null; pick the text area item
You commented that it isn't working. Well, it is. If it doesn't for you, then you did something wrong (although, I can't imagine what would that be, regarding the fact that it is just one property you had to set).
So: if I leave the text area empty and push the button, error message is here:
As of a video with demonstration: I don't have any. Google for it, if you desperately need it.

How to implement Find-on-Page command in MFC web browser control with pre-filled search word?

I'm using the MFC web browser control in my dialog-based MFC project to display some HTML content and I am trying to make it show the "Find on page" dialog window with the search word already pre-selected in it. (What you'd get if you hit Ctrl+F in the IE web browser.)
If I do the following the find dialog is shown OK, but it doesn't seem to support a way to pre-fill the search word:
IWebBrowser2* pWebBrowser = NULL;
LPUNKNOWN unknown = m_browser.GetControlUnknown();
unknown->QueryInterface(IID_IWebBrowser2,(void **)&pWebBrowser);
if(pWebBrowser)
{
HRESULT hr;
CComVariant varNull;
if(SUCCEEDED(hr = pWebBrowser->ExecWB(OLECMDID_FIND, OLECMDEXECOPT_PROMPTUSER, &varNull, &varNull)))
{
//Success!
}
pWebBrowser->Release();
}
if(unknown)
{
unknown->Release();
}
I found this MSDN page, that says:
OLECMDID_SHOWFIND Tells the receiver to show the Find dialog box. It
takes a VT_DISPATCH input param.
So evidently there's another Find command with OLECMDID_SHOWFIND ID, but I can't seem to make it work. I don't understand what is this VT_DISPATCH input param either? When I try this -- a total shot in the dark due to the lack of documentation:
CComVariant var1 = L"Pre-filled search word 1", var2 = L"Pre-filled search word 2";
hr = pWebBrowser->ExecWB(OLECMDID_SHOWFIND, OLECMDEXECOPT_DODEFAULT, &var1, &var2);
but I get hr=0x80040100 or "Trying to revoke a drop target that has not been registered"
Any idea how to make it work?

WinRT W8 Create WebView in C++ and add it to the main view

I'm currently trying to display a webview in a WinRT application (without c#).
First, is it possible ?
I'm currently trying to do it that way:
Windows::UI::Xaml::Controls::WebView^ webView = ref new Windows::UI::Xaml::Controls::WebView();
webView->NavigateToString("http://www.google.com");
But as I want this code to be run in the main thread (I think, to create a UI element it's compulsory) I'm running it like that:
Windows::ApplicationModel::Core::CoreApplication::MainView->CoreWindow->GetForCurrentThread()->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler(
[]
{
Windows::UI::Xaml::Controls::WebView^ webView = ref new Windows::UI::Xaml::Controls::WebView();
webView->NavigateToString("http://www.google.com");
}
));
Bad point is that this line:
webView->NavigateToString("http://www.google.com");
Is never reached. In the output console I have three exceptions raised (while debugging step by step) at that line:
Windows::UI::Xaml::Controls::WebView^ webView = ref new Windows::UI::Xaml::Controls::WebView();
The exceptions raised are the following:
First-chance exception at 0x763B4B32 in Direct3DApp1.exe: Microsoft C++ exception: Platform::WrongThreadException ^ at memory location 0x0320EFE4. HRESULT:0x8001010E
First-chance exception at 0x763B4B32 in Direct3DApp1.exe: Microsoft C++ exception: Platform::WrongThreadException ^ at memory location 0x0320EFE4. HRESULT:0x8001010E
First-chance exception at 0x763B4B32 (KernelBase.dll) in Direct3DApp1.exe: 0x40080201: WinRT originate error (parameters: 0x8001010E, 0x00000051, 0x0320E494).
If you have any idea how to create a webview and display it in a C++ only application on Windows 8 (not Windows Phone 8), it would be great. Meanwhile I'm strongly thinking about integrating webkit in my application if it could help me to display a webkit webview in C++ only.
Thx
With XAML like this:
<Page
x:Class="Win81CPlusPlus.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Win81CPlusPlus"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
x:Name="grid">
</Grid>
</Page>
And C++ code like this:
MainPage::MainPage()
{
InitializeComponent();
auto webView = ref new Windows::UI::Xaml::Controls::WebView();
Grid^ grid = safe_cast<Grid^>(this->FindName("grid"));
grid->Children->Append(webView);
auto uri = ref new Uri(L"http://www.stackoverflow.com");
webView->Navigate(uri);
// or you could ...
//webView->NavigateToString(L"<html><body><h1>Hello</h1></body></html>");
}
You can construct, add to a parent, and navigate to a URL (or a string).
You can use the Dispatcher as well:
Windows::ApplicationModel::Core::CoreApplication::MainView->CoreWindow->GetForCurrentThread()->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal,
ref new Windows::UI::Core::DispatchedHandler(
[this] /* the this won't likely make sense from another thread */
{
auto webView = ref new Windows::UI::Xaml::Controls::WebView();
// will need to get access to the grid
auto grid = safe_cast<Grid^>(this->FindName("grid"));
grid->Children->Append(webView);
auto uri = ref new Uri(L"http://www.google.com");
webView->Navigate(uri);
//webView->NavigateToString("http://www.google.com");
}
));
The issue is that you'll need access to a parent element to which the WebView instance will be added.

Launch Content Editor from code

I have an application that is creating an new item in Sitecore then opening up the Content Editor to that item, it is loading fine but whenever i try to open the html editor i get a 'NullReferenceException'. This is only happening when i launch the application in this method.
Source Code:
[Serializable]
public class PushToCMS : Command
{
public override void Execute(CommandContext context)
{
//Context.ClientPage.Start(this, "Action_PushToCMS");
Database dbCore = Sitecore.Configuration.Factory.GetDatabase("core");
Item contentEditor = dbCore.GetItem(new ID("{7EADA46B-11E2-4EC1-8C44-BE75784FF105}"));
Database dbMaster = Sitecore.Configuration.Factory.GetDatabase("master");
DatabaseEngines engine = new DatabaseEngines(dbMaster);
Item parentItem = dbMaster.GetItem("/sitecore/content/Home/Events/Parent/");
// Load existing related item if it exists
Event evt = new Event(new Guid(HttpContext.Current.Items["id"].ToString()));
Item item = dbMaster.SelectSingleItem("/sitecore/content/Home/Events/Parent/Item");
if (item == null)
item = CreateNewEvent(engine.DataEngine, parentItem, evt);
Sitecore.Text.UrlString parameters = new Sitecore.Text.UrlString();
parameters.Add("id", item.ID.ToString());
parameters.Add("fo", item.ID.ToString());
Sitecore.Shell.Framework.Windows.RunApplication(contentEditor, contentEditor.Appearance.Icon, contentEditor.DisplayName, parameters.ToString());
}
The only difference i can tell in the loading of the two methods is the url to the html editor, however i dont know where this is being defined or how i can control it.
Launched through normal method:
http://xxxx/sitecore/shell/default.aspx?xmlcontrol=RichTextEditor&da=core&id=%7bDD4372AC-5D37-4C9E-BBFA-C4E3E2A27722%7d&ed=F27055570&vs&la=en&fld=%7b60D10DBB-7CD5-4341-A960-C7AB10347A2C%7d&so&di=0&hdl=H27055699&us=%7b83D34C8A-4CC4-4CD9-A209-600D51B26AAE%7d&mo
Launched through RunApplication:
http://xxxx/layouts/xmlcontrol.aspx?xmlcontrol=RichTextEditor&da=core&id=%7bDD4372AC-5D37-4C9E-BBFA-C4E3E2A27722%7d&ed=F27055196&vs&la=en&fld=%7b60D10DBB-7CD5-4341-A960-C7AB10347A2C%7d&so&di=0&hdl=H27055325&us=%7b83D34C8A-4CC4-4CD9-A209-600D51B26AAE%7d&mo
any help on this would be greatly appreciated.
Phil,
If it is not too late for the answer... :)
It might be the case that you run this code without the permissions to read the core database. In this case, when you try to call contentEditor. you'll get NullReference. I would recommend you using another format of running the application - use another method:
Sitecore.Shell.Framework.Windows.RunApplication("Content Editor", parameters.ToString());
If this doesn't help, please attach the stack trace of the exception you get.
Hope this helps.