In vscode how do you tell if or where a document provided by a TextDocumentContentProvider is shown - visual-studio-code

I am working on an extension in vscode that uses a TextDocumentContentProvider to provide users with feedback on the effects of changes they make to the file they are editing.
A common use case is for the user to drag the virtual document to a separate pane so they get a side by side view of the live document and the virtual document.
To display the virtual document, I need to call showTextDocument(), however this opens it in the current pane, giving two copies of the same document, and also makes it the current tab, hiding the document the user is working on.
I do not seem to get open or close events for virtual docs - which would mean I could just not call showTextDocument(), and I cannot find any API that allows me to find out or set which pane a document is open in.

WebViews are a special document type. You neither can enumerate open tabs for them nor can you influence the exact tab position, except for the view column. OK, the same about the tab position can be said for normal text documents.

Related

Taking a Word document out of design mode

This should be a really simple thing that for some reason I can get to work.
I have an MS Word document which has a drop-down field. If I double-click it - a dialog comes up to add or remove things from the drop-down field.
I just need to be able to get out of this mode so that the drop-down field behaves like it should from a user's point-of-view rather than from a design point-of-view. Basically I just need it to display the items rather than a dialog to allow me to add and remove the items.
According to what I've read, it looks like I should be able to do this by going to Developer, and then toggling the Design Mode button. This doesn't work; whether the Design Mode button is on or off I still can't get it to just act like a drop-down.
Thanks much
It sounds like you're using a legacy form field dropdown. For those to operate as a dropdown, you must protect the document for forms:
On the Developer tab, click on Restrict Editing. The Restrict Editing task pane opens.
In the task pane, check the box beside Allow only this type of editing in the document.
In the next dropdown, choose Filling in forms.
Click on Yes, Start Enforcing Protection.
Protected forms don't allow text to be edited in protected sections. In those areas, only form fields allow you to enter text. If that's too restrictive, look into Content Controls, which don't require document protection.

Embedded objects in Word document

Embedded objects inside word document display contents only as long as they are opened on the source system. If you mail that to someone who opens on his system it just displays icon no contents.
Is there a way to resolve this so that anyone on any system should be able to double click the embedded object (say for example word doc within main word doc) and be able to view its contents. As of now if just displays as an icon no contents if viewed on any other system.

forms showing in runtime as soon as they are created

In runtime when the forms are being created, 2 forms constantly keep appearing when I haven't programmed them to show as soon as they are created, and my system runs. I was wondering why this happened and whether there is anything to solve this? I don't think I need to show my code here since it's pretty basic and there is none for the OnCreate event.
From the main menu, use Project->Options->Forms, and remove the forms you don't want to see from the Auto-create list. (Click the >> button to move them from the left side to the right side.)
(It's worth mentioning that you can also affect the order in which any autocreated forms or datamodules are created from that dialog by just dragging them up or down in the list. Note that the first form to be created becomes the application main form, so when it is closed the application will close as well; this means that the only thing above your main form in the autocreate list should be datamodule(s) that are accessed by the main form.)
If you never want any forms auto-created, go to Tools->Options->Environment Options->Form Designer, and uncheck the very last item labeled Auto create forms & data modules at the bottom. Note that your main form will always be auto-created, as it's what controls the application's lifetime for form based applications.
By default delphi creates all the forms in the beginning. You can open the .dpr file and delete the ones that you don't need. You could also do that from the UI.
For the forms that you don't want to appear at the start of runtime, go to the properties of the form (lower left hand side) and uncheck Visible. This should do the trick

Predefined Add Dialog not working as expected in Lightswitch 2012

I've created a query to use in an AutoCompleteBox and it works as expected when the user select the AutoCompleteBox in the grid as shown in the picture below
However if the user click the plus button to add a new record using the predefined Add Dialog then the query and the AutoCompleteBox's format doesn't work as shown in the picture below
Why is this happening and how I can fix that?
Thanks
I haven't yet found a way to edit the default Add New dialog.
Instead, make a new screen, select the "New Data Screen" template, and link it to your entity data. You can customize the screen to fit your needs, even make it a Modal Window by changing the Control Type in the screen properties. Once you have the screen set up the way you want, go back to your grid screen, and double click on the Add... command in the Command Bar of your grid, to edit the AddAndEditNew_Execute code. In that method, call your custom screen.
So, as I got to thinking about this some more, I came back to the thought I had when I tried to do this a few months ago. There has to be a better way, so I Googled it again.
This time, I found something. He's using an old version of Lightswitch, but I've successfully applied his technique in my application built in Lightswitch 2012.
http://www.c-sharpcorner.com/UploadFile/051e29/modal-window-in-editable-grid-screen-in-lightswitch-2011/

ActiveX Print a web page

I would like to find or write an Internet Explorer ActiveX control that will allow me to print a web page to a specific printer without a dialog box. The problem that I am having is that this particular page needs to print to a label printer with very specific orientation properties. Can anyone get me started? Thanks.
If you hook in to IE windows messages and wait for the print dialog to activate, using GetWindowText() to find the window with the "Print" title, you can send messages explicitly to the various controls to set the settings and click the "Print" button. This is much easier to do in IE7 than IE8, but with the help of SPY++ to find control IDs for each of the settings you can do it.
Why the requirement that you print without a dialog box? You can bring up the dialog box automatically with Javascript, and that way the user can choose the printer & options; otherwise you will have to hardcode the printer name. Ex:
<body onload="javascript:window.print();">
Perhaps you should probably consider outputting to something like a PDF or Word Document that is designed for that kind of specific layout - the HTML may render differently on various IE versions, and you probably don't want something as specific as labels to be messed up.
I have done it and its easy but I just can't seem to get my ActiveX control to register...
When I register is manually it works, but when I run it by itself, it fails.
ALl you need to do is create a form that which has got a WebBrowser control on it. Pass the page you want to view to the NavigateURL property and call the Navigate method.
After the navigation has been completed, you can call the print method. Since you a printing to a label printer, just remember to set the page margings and remove the header and footer and set it back again when the page has finished printing.
(I did my work in .Net)