How can I extract a PNG from a delphi XE5 firemonkey style? - delphi

I'm trying to change the color used when elements of the MetropolisUIBlack.Style XE5 style (Firemonkey). It seems that, in order to do so, the simplest way would be to edit the PNG image that contains all these elements i the style (MetroBluestyle.png).
Unfortunately, I can't find a way to save the PNG that is contained in the style element to a file so I can manipulate it safely and reload it once the color has been changed.

Use the Bitmap Style Designer provided with the product.
You can find it in the Tools menĂ¹ and, once started, you simply have to open the MetropolisUIBlack.vsf file, select the "style.png" item under Images and click the Export button (above the right panel where you can see a preview of the picture).
Edit the picture with your favorite editor (i.e. The Gimp), save the picture, and load it back in the style using the Update button (just left the Export one).
You can save your style with a different name and use it as usual.
HTH

Related

How can I remove Named Color Set in Xcode completely?

I used named a color set at first and recently I removed it from my assets file. (Due to the lack of support of iOS 10)
But it seems they still exist in my project.
If I set a color with same value as the removed named color in Interface Builder, it notices me the named color is missing.
Does anyone have some solution for this kind of case?
Thanks!
I struggled with this for a while and there seems to be no easy way to delete a namedColour in XCode (yet). Here's how I solved it.
Go to your storyboard and open it as XML.
Scroll down the bottom of the document to see a resources tag.
Inside of that, you should see custom resources like images and namedColour. Simply just delete any namedColor elements that you don't want anymore, and save - you're good to go!
Note: You may also want to search in the XML for any references to that namedColor and delete tag. For example, I would search in my XML for name="Color" and delete any tag that has it.
I inherited a project that used named colors where we wanted to support iOS 10. You won't like this answer but the only way I found to fix it was to go into the xml of the storyboard and do a find/replace on all of my named colors.
You can easily see the xml of the storyboard if you open the Version Editor in the upper right of the project navigator.
This is a (very annoying) bug in Xcode. Here's how you can fix it:
Open the color dropdown and click on Other...
Navigate to Color Sliders (the second icon from the left).
Select RGB Sliders from the dropdown.
Click inside the Hex Color # text field and press Enter.
I just came across this in Xcode 13:
The color doesn't show up in Assets.xcassets but there's an entry in the regular color drop-down menu in the inspector and it's marked as "(Missing)":
This happens if there's a UI element that's still using a color that was deleted.
How to remove the missing color without changing the actual storyboard code manually:
Open the storyboard as source code (right-click -> "Open As") and search for the exact name of the color (without "missing"), in my example that would be "HIghlightColor".
Write down what UI elements are still using the color - it's easiest to just copy their ids.
Open the storyboard again but this time as "Interface Builder - Storyboard".
Go through all of the UI elements that are still using the missing color (you can use the id in the search/Find Navigator!) and change their color to something else.
Repeat step 1-4 for the remaining storyboards.
Once the missing color isn't used by anything anymore, it'll vanish from the list and the storyboards' code automatically, including the entry in the <Resources> tag.
Delete the Asset Catalog in your project:
AssetCatalog
This will delete the missing name, this works for me.

Firemonkey default Windows style?

Delphi XE6
When I create a new Firemonkey Desktop Application, and drop a TGrid on the form, and edit the default style, it shows the TImage as:
"StyleBook1Windows 7style.png"
Where is the *.vsf file for this image. I would like to export the PNG from it and modify it and create a new style.
If you are trying to create your own style, you can get the bitmap used by an existing style using the following steps.
Launch the Bitmap Style Designer from the Delphi IDE menu - Tools |
Bitmap Style Designer.
Then from the Style Designer, select File | Open followed by selecting the .vsf file you wish to extract the bitmap from. You'll find a bunch of these in your c:\users\public\documents\embarcadero\studio\17.0\Styles directory. Change the 17.0 in the directory name to 14.0 for Delphi 6.
From the list of objects on the left, select Images. Expand images and you should see style.png
Now select Export (which is above the bitmap) which allows you to save the bitmap to a file
You don't really need the original file. If you click on the SourceLink property (click on the (TBitmapLinks)--not on the '...' button)) the Bitmaplinks Editor opens. There you can upload your own png file and define the areas you want to use in the style.

Windows ribbon split button gallery button image

I'm using Windows Ribbon for Delphi (from http://www.bilsen.com/windowsribbon/commands.shtml) and I have a split-button gallery, to give a drop-list of items that I can populate at runtime.
The part that isn't working is when I select an item from the gallery, its image isn't automatically transferred to the split button and I can't find a way to make it happen manually.
I've tried looking through the MS documentation but I can't see anything there that helps change the image of the button.
For the avoidance of doubt: I've checked in MSPaint and the brush selection works exactly as I want my button to work.

How can I show only certain file extensions in an open-file dialog?

When I open a folder with an OpenDialog, how can I filter it so users can view only certain files (e.g., Stringgrid, *.sg) and the files with any other extension do not appear in the dialog window?
Set the OpenDialog.Filter property to the file filter you want.
You can do this in the Object Inspector:
Click in the Filter property, and you'll see a small button appear on the right edge with ....
Click that, and you'll see a dialog appear.
On the left side is the description of the file (for instance, Excel files (*.xls)). The right side is the filter you want to use, as in *.xls.
You can also set it in code before displaying your dialog:
OpenDialog1.Filter := 'Excel files (*.xls)|*.xls';
Of course, replace the Excel stuff with any description and mask you want to use.
The Filter and FilterIndex properties are used to specify which file extension(s) to display (note that the user can override the filter manually, though).
The OnIncludeItem event is used to selectively allow/disallow individual files/folders from being listed in the dialog.

How to get the Preview image using advImage plugin in Rails application

HI ,
i am using Tinymce with advimage plugin in my rails application.
I have doubt that When i click on the Insert/Edit iamge in the Tinymce a popup window comes and in the appearance tab the preview is not shown
How to get the preview image ?? in the Appearance tab
There are two "previews" in the Advanced Image plugin dialog. The first is the preview of the image you have selected. The second is to allow you to visualise what the style changes you make (for instance border, alignment) would look like and uses an "sample" image.
I assume what you would like to see is your selected image displayed instead of the "sample" image. To achieve this, you will need to alter the advimage plugin, which is bundled with TinyMCE, to use the currently selected image instead of the default (sample.gif).
One thing to consider is that if your end user selects a large image, then they wouldn't be able to see the application of the style changes within the small preview window.

Resources