Electron app - Custom components in native header - electron

Is it possible in Electron to put custom components into the native application header?
For example, to achieve a design as such:
Currently my app just has the default one with just the title text
Is there a way to make it bigger and put content in there? Or do I have to somehow hide the native header and recreate the native buttons myself?
I suspect it's the latter, but in that case, how do I hide the native one and hook up ability to drag the window with it?
Or is this design entirely not possible in Electron?

The design you're looking for can be achieved, but only on macOS, by using the titleBarStyle property set to either hidden, hiddenInset, or even customButtonsOnHover, in the options passed to new BrowserWindow().
This is explained in more detail in Alternatives on macOS:
There's an alternative way to specify a chromeless window. Instead of
setting frame to false which disables both the titlebar and window
controls, you may want to have the title bar hidden and your content
extend to the full window size, yet still preserve the window controls
("traffic lights") for standard window actions.
There might still be a few issues, such as not being able to drag around the window from its title bar any more, but they are documented in the Frameless Window page; for instance, this specific problem can be solved by adding -webkit-app-region: drag; to the CSS relative to the region(s) you wish to make draggable.

Related

Create a window with Lua?

So as the title says I need to make code to create a window and add some content to it, like text, images etc, so Is it possible or not?
(note that window needs to be interactive, that means you can code buttons, progress bars, selection boxes etc.)
You cannot do this in Lua alone. There are plenty of libraries and frameworks available that allow you to create graphical user interfaces.
http://lua-users.org/wiki/GraphicalUserInterfaceToolkits

How to make Browser Window draggable?

I have a Browser Window (using Electron.atom.io) and I'm trying to make it so that you can click over most of the screen (except inputs, etc) and drag it over your desktop - basically, I don't want to restrict drag just to the title bar.
Does anyone know how I might be able to do this?
Electron supports a webkit property intended for frameless windows, that I believe should work for you. The documentation is here. Basically just make a class and add it to any elements you want draggable:
.draggable {
-webkit-app-region: drag;
}

Can I enlarge the menu font size in Delphi 2?

Everything I've found says I can't do this with Delphi 2's TMainMenu but if somebody here has managed it somehow, I'd really like to know the trick. I found code that changes the System menu font size but none that confines the change to only the application. Anyone here know how to do this or do I have to just accept Delphi 2's tiny menu font size that appears on today's large screen monitors? (Moving the app to an upgraded Delphi is not the answer I need ;-)
The only way to achieve per application custom menu fonts is with an owner drawn menu. Delphi 2 does not support owner drawn menu items directly in the VCL properties of a TMainMenu component. This support was introduced only in Delphi 4.
You could still implement an owner drawn menu, but it would involve implementing them using standard Windows API techniques, and handling the required messages on the forms which own the menus involved. It is not especially difficult but not as straightforward as the event based implementation available in Delphi 4 and later.
You can still use a TMainMenu to define your menus but in your application you would then need to programmatically set the owner draw flag on the menu items and handle the resulting messages appropriately. Doing this, you will need to handle all aspects of drawing the menu - you cannot simply set/change the font and leave the system to draw the menu items. You may also need to provide additional handling for any keyboard shortcuts you have set up.
If this is a viable approach then information on implementing owner drawn menus at the API level can be found here.

Custom Dock in Gimp

In GIMP: is there a way how to make my own custom dock (toolbar) where a could put my most used functions?
Something like this:
Create new empty dock or toolbar
Somehow set what functions will be in it
(any of the functions, no matter it has an icon or where in menus is located)
I'd like to have it so I don't have to search in menus every time I need something. I'm aware that I can make keyboard shortcuts but they are difficult to remember since I don't use Gimp every day. I'm used to this from Corel Photopaint and I think it is really useful.
Thanks for your suggestions.
In GIMP 2.8, you can only customize the dockable dialogs - by dragging then around, and in another level, customize tool presets and make use of the tags in the presets dialog to quckly access paint-modes with set brushes, gradients and painting dynamics - so, keeping the tool-presets dialog around, and appropriately using the tags can give you quick access to these settings.
You can't, however, add additional menu entries or icons to select particular plug-ins (filters) - and access those from any of the dockable dialogs. without rebuilding GIMP, you could edit the XML files at /usr/share/gimp/2.0/menus to customize your menus.
In the master branch, the unstable "GIMP 2.9" which will eventually become GIMP 2.10, there is a "search" action implemented, initiated by pressing the / character that will probably make it for the need to quickly find-out any operations wanted.

Delphi XE5 Android TButton colors

I need change color of 50 buttons in one form.
Every button another color and color want to set by code(no design editor).
It is firemonkey mobile application.
By my opinion, without making your own button that doesn't use FMX styles completely (which would break multiplatform compatibility if you are looking forward to support multiple platforms with their native styles), you may apply some filter on top of each of those buttons but on some styles this may cause the text not to be visible, implementing your own filter might get you the desired result:
Effect:=TFillRGBEffect.Create(Self);
Effect.Color:=$80FF0000;
Effect.Parent:=SomeButton;
Another way would be to take advantage of TColorButton with TText on top of it, but this way the entire button won't be filled with your color, but you can modify default/custom style for each platform in order to get what you need (this indeed needs to be done in the designer but you would have to create just one style for each platform you need to support and not 50 for each button):
Button:=TColorButton.Create(Self);
Button.Color:=$80FF0000;
Text:=TText.Create(Button);
Text.Parent:=Button;
Text.Align:=TAlignLayout.alClient;
Text.Text:='Hello';
Text.HitTest:=false;
Button.ClipChildren:=true;
Button.Parent:=Self;

Resources