How to restore windows theme for one control - winapi

I use the following code to disable themes on a single control:
SetWindowTheme(yourControl.Handle, "", "");
or just
SetWindowTheme(yourControl.Handle, "explorer", "");
but after a while, I need to restore the original Windows Vista/Seven theme on that control. How can do it? I looked for a "default" name without finding it, all examples cite "" or "explorer", which disable the theme.

From the SetWindowTheme documentation
When pszSubAppName and pszSubIdList are NULL, the theme manager removes the previously applied associations. You can prevent visual styles from being applied to a specified window by specifying an empty string, (L" "), which does not match any section entries.
Note that NULL and "" are not the same thing.
You can restore the old theme for the application by just calling SetWindowTheme again with NULL values for the last two parameters:
SetWindowTheme(yourControl.Handle, NULL, NULL);

Related

create and show one use only dialog, constructed based on global state.

I have a plugin which need to show a (Modal) dialog each time the user double click on a word.
Detecting double click is no problem, but the exact fields/values in the dialog depends on exactly which word the user clicked on, and some mutable global state. So I can't create the dialog until the moment before I need to show it. And here is the problem: How do I do that?
Right now I use this code:
var dialogName="uniqueDialog" + counter++;
CKEDITOR.dialog.add(dialogName,function(editor) {
// Creating dialog here.
});
CKEDITOR.instances.editor.openDialog(dialogName);
This works, but having to add a uniquely named dialog, just to show it once and then newer use it again seems really really wrong. Also I fear this will keep using resources since the dialogs are newer removed(I could not find any remove method).
So my question is: Is there a better way to dynamical create and show a "one use" dialog?
Update:
If bootstrap is not allowed then maybe an addFrame version of the dialog is acceptable. This could then refer to a html file that can load from parameters.
NB: The plunkr only works, if you fork and edit it, otherwise it will give you a 404 for the template.
Here is a quick plunkr:
plunky
And here is the plugin in question:
CKEDITOR.plugins.add( 'insertVariable', {
requires: ['iframedialog'],
icons: 'insertvariable',
init: function( editor ) {
editor.addCommand( 'varDialog', new CKEDITOR.dialogCommand( 'varDialog' ) );
CKEDITOR.dialog.addIframe('varDialog','varDialog','sample.html?var='+item,500,400);
editor.ui.addButton( 'insertVariable', {
label: 'Insert Variable',
command: 'varDialog',
icon: this.path + '<insert gif>'
});
}
});
Obviously you are not creating dialogs anymore with different content, but you are referring to another piece of html, that can change. I've kept the bootstrap thing in there as well for reference.
I made one final edit, that will show the current contents. So I think that is roughly what you want. Check it out.
Previous Answer
If you are prepared to use bootstrap, then you can do no worse than check out their modal dialog, which can be just be shown and hidden at will.
http://getbootstrap.com/javascript/#modals
It's simple and cuts down any need to keep creating your own dialog. The dialog won't be one use type, but you will set the defaults as necessary. The varying content link is here:
http://getbootstrap.com/javascript/#modals-related-target
That would be the quickest way to get this going. It all depends on whether you want to use this framework. As CKEDITOR is already using JQuery it is an option worth considering.

Change sapui5 fileuploader browse button text

I'm looking for a way to change sapui5 language at runtime based on the loggedin user language. I have the i18n properties file in place. The challenge that I'm facing is to change the text on the FileUploader button. This text is not being picked up from the properties file. It is always 'Browse'
I'm using sap.ui.commons.FileUploader()
var FileUploader = new sap.ui.commons.FileUploader({
id: "fileUploader_id",
fileType: "zip",
uploadOnChange: false,
buttonText: oBundle.getText(FILEUPLOADER_BUTTON_TEXT),
tooltip: oBundle.getText(FILEUPLOADER_BUTTON_TIP),
});
Similar problem with the table when there is no data. The table displays 'No data' in english instead I want it to be in a user specific language.
The "buttonText" property from sap.ui.unified.FileUploader is not working?
I just gave it a try to see and the button's label changed accordingly.
<u:FileUploader buttonText="{i18n>browseText}"></u:FileUploader>
In older versions of SAPUI5 (using commons library), the button Text can be changed by overwriting the standard buttonText parameter. i.e., in this case the standard "FILEUPLOAD_BROWSE" has to be overwritten in the local i18n.properties file. We cannot use the name that suites us (like FILEUPLOADER_BUTTON_TEXT).

IShellView: ColumnHeaders not hidden if AutoView does not choose Details

I`m using an IShellView instance with the FVM_AUTO (-1) flag as view mode. That means the explorer should choose a viewstyle that fits the content of the displayed folder.
This works fine except the fact, that columnheaders are visible for viewstyle other than Details, e.g. Thumbnails.
The IShellView object and view window is created like this:
ShellFolder1.CreateViewObject(this.Handle,
ref IID_IShellView,
out shellViewObject));
IShellView shellView = shellViewObject as IShellView;
FolderSetting folderSettings = new FolderSetting();
folderSettings.ViewMode = (int)View; // view is FVM_AUTO = -1
folderSetting.FolderFlags = FolderFlags.NoClientEdge
| FolderFlags.ExtendedTiles
| FolderFlags.AutoArrange
// only columnheaders for view mode details
| FolderFlags.NoHeaderInAllViews;
shellView.CreateViewWindow(oldView, ref folderSettings, isb,
ref rect, ref m_ShellViewHandle);
A list of available folder flags can be found here: http://msdn.microsoft.com/en-us/library/bb762508(VS.85).aspx
Any suggestions how to tell the view that column headers should be displayed only for "details" in auto view mode? setting FolderFlags.NoColumnHeader does not change anything.
Thanks
this behavior seems to be a bug and is reported on MS connect
Additional information from MS support:
The folder controls the view. The values you pass to CreateViewWindow are merely suggestions. For the most part, these suggestions are respected, but a folder is technically allowed to ignore them.
In particular, this case overrides the suggestion for compatibility with Windows XP. If you use IShellView3::CreateViewWindow3, then this compatibility behavior does not apply, and the flags should be respected better. You can use the SV3CVW3_FORCEFOLDERFLAGS flag to make your suggestion more emphatic.
--> use IShellView3.CreateViewObject3 with the ForceFolderFlags flag

ck editor forcefully removing my html and body tags

I am trying to edit an entire html using fck editor. So that should contain tags like html, body ,DOCTYPE etc. But my problem is when I submit the data, fckeditor forcefully remove the above tags from the content. I want to avoid this. Is there any configuration issue there.
-Arun
look at this config option. CKEDITOR.config.fullPage. I believe it will permit you to edit the full page (and will preserve the contents) (i haven't used it.)
'ckEditor' (as it's now known) shouldn't allow html/script tags directly within the content. However if you have the latest version there is a 'source' view which allows all the source to be edited directly and may give you what you want.
Arun User this one .This is best solution for you.
var CKcontent = false ;
$(document).ready(function(){
// setup ckeditor and its configurtion
CKEDITOR.replace( 'content1',
{
//fullPage : true,
customConfig : 'config.js' ,
toolbar : 'BasicToolbar' ,
height : "300"
});
});
Set only fullpage : false if not show HTML content otherwise set true
Note: it implemented by me in our development

Windows Registry file association menu

I have recently(today) began meddeling with my registry from within Delphi. :)
all is working well and my custom file type now opens with my program, but there are 2 issues i can't solve.
1) I wanted the option to "open with" from all file types so i added
reg := TRegistry.Create;
reg.RootKey := HKEY_CLASSES_ROOT;
reg.LazyWrite := false;
reg.OpenKey('*\OpenWithList\EncryptionSystem', true);
reg.WriteString('','C:\Program Files\EncryptionSystem\EncryptionSystem.exe "%1"');
reg.CloseKey;
reg.free;
If I look in the registry using regedit it's sure there as it should seem to be but when I right click on a file and select Open With it's not there...
So I then added this
reg.OpenKey('*\shell\Encrypt\command', true);
reg.WriteString('','C:\Program Files\EncryptionSystem\EncryptionSystem.exe "%1"');
reg.CloseKey;
This does work for every file but the option is right at the top with "open" and "edit".
I kinda want it to appear in a menu subsection like most programs do...
I realised that i needed to play with shellext but i did not understand the structure of how these worked withing the context menu handlers... I'd learnt all I had from reading the registry anyway... I know the name for the shellext appears later after the ".*" but as for the meaning of the big jibberish keys I have no idea.
It looks like the "Open with" menu is not populated by that registry key alone. It's trumped by an extension-specific list stored by Explorer at the following location:
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
I'd venture a guess that the list you're adding your application to is only used if Explorer doesn't have anything better to use — so only for files that don't already have their own "Open with" lists defined.
Also, it looks like an "Open with" registry entry is supposed to have a different form from the one you're using. The key should be the name of the EXE file, such as ExcryptionSystem.exe. The default value for that key, if present, should be an empty string. I'm basing this just on what I see in the registry on my own system.
You should take a look at the File Types MSDN article, part of the Introduction to File Associations.
Looking at the registry it looks like it your line should be changed to.
From
reg.OpenKey('*\OpenWithList\EncryptionSystem', true);
reg.WriteString('','C:\Program Files\EncryptionSystem\EncryptionSystem.exe "%1"')
to
reg.OpenKey('*\OpenWithList\EncryptionSystem.exe', true); //note exe
reg.WriteString('','C:\Program Files\EncryptionSystem\EncryptionSystem.exe "%1"')
Check this first.
On my W7P they're not as referenced. Instead they're at...
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts

Resources