How to use customized tool bar in tiny mce? - tinymce

I'm using tiny mce in one of my projects and client do not want to use the Horizontal tool bar of tiny mce. He wants a centralized custom tool bar from where user can control all the properties like text color, type of text, size, back grounds and every thing that is needed to do while designing a web page using templates. I configured the mce instance with out its default tool bar and controlled the properties from the customized tool bar. And the properties are applied to the tiny mce instance as a whole. But now, the requirement has come up that, the text editing should be in MS office style.That means, if user has placed cursor at one place and changes color, nothing will be affected, but if he starts typing from the cursor position the text should have the color which was set recently. I tried to use the external tool bar option. But, my work area and customized tool bar are at different z index levels. So, positioning the tool bar fails. If I append the tool bar to my customized tool bar, it is not click-able. So, how to invoke tiny mce's core functionality using customized tool bar?
Or, Kindly suggest, should I change editor ? Then, which one should I go for ?
EDIT
As per the suggestion, I'm writing the function save the property styles and insert the span at caret position. But I'm facing some problems and could not do it after spending whole day. I could add span at caret position by using following code.
marker = ed.selection.getBookmark();
ed.selection.moveToBookmark(marker);
tinyMCE.execCommand('mceInsertContent',false,'<span id="mytitle"></span>');
But still, I failed to type inside the new span. Also, I could not figure out how to set styles to this span.

If your aim is to have your tinymce behave like MS Office you should write an own plugin which will take care of this.
I suggest if a user has placed the cursor at one place and changes color you save this color as a setting to your tinymce instance like: ed.color = 'choosencolor';
When the user start typing now you can insert a span on the first keystroke and set the color as css class or style property to this span.

Related

Form borders and title bar

I'm pretty sure this must have been asked before but I can't seem to find a solution. I have some pop-up forms which I want to show without title bar since I've designed custom placement functions and I don't want them to be moved or closed from the title bar, so having it show only makes the form look uglier. I haven't found a way to hide it other than setting the form border to none, but that makes some small forms that popup on top of other forms (which I don't want to close when opening the other form because of crossed references and various visual reasons) merge with the form on the background and make it hardly distingishable.
So, I need a way to hide the form title bar while being able to set a thin border for the form to establish its bounds clearlier. I've tried setting a rectangle around my forms, but since I'm using form headers I can't put it around the whole form. I guess I could put one around the header section and another around the details section, but it makes it look horrible. Any simple way to achieve what I intend to do?

Qt form embedded in GUI results in shrinking to minimum size

So I have this GUI .ui file made with Qt, which is embedded inside a sidebar on some Qt app I'm working on. Problem : it gets shrinked to an unsuable size.
My ui form starts with a QWidget, which is the main and base area for adding more things. This is set to be a grid layout (I didn't insert a grid layout manually, I just set the base QWidget to have one using the dedicated button at the top).
And it contains one thing only : a tab widget with all my stuff inside on two tabs.
And that's it.
Of course I did play with the size policy of everything, it's all set to Expanding and all.
This form is embedded by code into a larger tab widget. There is a new tab for every new form, I have like 10 different forms like this one.
Some actually have a QMainWindow at their base, and are not shrunk to death. I don't understand the difference, but I when I set my base thing to be a QWindow, the form does not shrink.
I also have one form in another tab that has a QWidget at its base and is not shrunk to death.
Any other information I could provide to help you guys help me ?

How to bring label over edit control

I'm trying to set up a TEdit that will be used for research, so, it would be great to have a label displaying "current" / "count" over it, as observed by pressing CTRL + F in Google Chrome:
It seems that the TLabel control's always placed behind the TEdit control.
I also tried label1.BringToFront (Both at designtime and runtime), but it had no effect. Is there a way to place a label over an edit control?
TLabel inherits from TGraphicControl which cannot be shown on top of windowed controls, no matter how many times you try to use BringToFront it's just not going to happen.
However, you can use a container control such as a TPanel that can be used to contain your TEdit and TLabel controls, see this image as an example:
That is a quick and dirty way, it's simply a TPanel containing a TEdit and TLabel as child controls
The preferred way however is to create your own control which would give you full flexibility. Often trying to piece together multiple VCL controls to appear and function how you want is not usually ideal, and so by doing it the custom way gives you more freedom and possibilities.

Make Dynamic Forms

I'm using Centura / TeamDeveloper 6.1
Is it possible to make the content of a Dialog / Window dynamic?
For example if I load a table inside a tab it is dynamic because the child table always takes the size of the tab.
I want the same behaviour with buttons etc. not that they always change size but that they move their position to stay like in the center no matter how far I resize the window without me having to write a function that calculates everything and that moves them around.
In C++ / QT I would use Layouts.
As it is right now I maximize the Window but the design is stuck on the left side.
Team Developer does not offers support this feature in native way.
however you can design your app to capturing when the formwindow size change and so your visual objects can change their position according the new container size.
there are some samples demonstrating this behaviour.
please, do a search here for "resize" samples

JavaFX 2 custom popup pane

The JavaFX 2 colour picker has a button that pops up a colour chooser pane like so:
I'd like to do something similar, in that I'd like a custom pane to pop up when the button is clicked on and disappear when something else is clicked (in my case, a few image thumbnails). What would be the best way of achieving this? Should I use a ContextMenu and add a pane to a MenuItem somehow, or is there something else I should look at?
It's kind of difficult to do well with the current JavaFX 2.2 API.
Here are some options.
Use a MenuButton with a graphic set in it's MenuItem
This is the approach taken in Button with popup showed below's executable sample code.
Use a PopupControl
Take a look at how the ColorPicker does this in it's code.
ColorPicker extends PopupControl. You could do this, but not all of the API required to build your own PopupControl is currently public. So, for JavaFX 2.2, you would have to rely on internal com.sun classes which are deprecated and will be replaced by public javafx.scene.control classes in JDK8.
Use a ContextMenu
So, I think your idea to "use a ContextMenu and add a pane to a MenuItem" is probably the best approach for now. You should be able to do this by using a CustomMenuItem or setting a graphic on a normal MenuItem. The ContextMenu has nice relative positioning logic. A ContextMenu can also be triggered by a MenuButton.
Use a Custom Dialog
To do this, display a transparent stage at a location relative to the node.
There is some sample code to get you started which I have temporarily linked here.
The sample code does relative positioning to the sides of the main window, but you could update it to perform positioning relative to the sides of a given node (like the ContextMenu's show method).
Use a Glass Pane
To do this, create a StackPane as your root of your main window. Place your main content pane as the first node in the StackPane and then create a Group as the second node in the stackpane, so that it will layer over the top of the main content. Normally, the top group contains nothing, but when you want to show your popup, place it in the top group and translate it to a location relative to the appropriate node in your main content.
You could look at how the anchor nodes in this demo are used to see how this might be adaptable to your context.
Is there a relevant update for this for JavaFX8?
There is not much difference of relevance for Java 8, in general the options are as outlined in this post based on Java 2.2 functionality. Java 8 does add Dialog and Alert functionality, but those are more targeted at use of dialogs with borders, titles and buttons rather than the kind of functionality desired in the question. Perhaps you might be able to start from the Dialog class and heavily customize it to get something close to what is needed, but you are probably better off starting from a blank stage or PopupControl instead.