How can I edit the body of my Pebble.js UI.Card? - pebble-watch

I have created a card and shown it already. Now I want to change some text on it while it's in view. Can I just do something like card.body = "blah blah"? How do I update it?

Just write:
card.body("my new body");
This syntax works to change any property on all Pebble.js Windows and Elements.

Related

how to call SetExtendedUI on CMFCToolBarFontComboBox

I am creating a MFC application based on example: https://github.com/microsoft/VCSamples/tree/master/VC2010Samples/MFC/Visual%20C%2B%2B%202008%20Feature%20Pack/WordPad
now i want to change the way to expand font name drop list in toolbar from DOWN key to F4. It seems i need to get the combobox and call SetExtenedUI(FALSE) on it, but i dont know where to do it.
To change the extended UI flag on a CComboBox, you call its CComboBox::SetExtendedUI member. When you have a CMFCToolBarFontComboBox you need to get to its combo box first. Since it inherits from CMFCToolBarComboBoxButton you can use its CMFCToolBarComboBoxButton::GetComboBox member to get a CComboBox*.
CMFCToolBarFontComboBox* pFontButton = ...;
CComboBox* pComboBox = pFontButton->GetComboBox();
pComboBox->SetExtendedUI(FALSE);
finally i switched to CComboBoxEx which works fine

how to delete the content of ace editor on a validation error

My question is related to set focus on ace editor
This time I want to delete the content whenever there is a validation error.
I have the used the pattern like
/^[0-4]$/ and /^([1-9][0-9]{0,3}|[1-5][0-9]{4}|60000)$/;
to check the value between 0-4 and 1-60000 respectively. When user provides invalid data my text area is cleared but not the ace editor. I also tried
$scope.close = function () {
rowObj.entity.value = editor.getValue();
editor.setValue("",0);
};
but that is not working.
to clear editor simply call editor.setValue("")

wysihtml5 - setting a value won't work, because 'sandbox iframe isn't loaded yet'

I'm just working on a little webservice. Therefore I am using an AJAX call and append my data to a table on my website. Here I can read and update already existing entries or write new entries. Everything works fine.
I want to have the possibility to update already existing with the wysihtml5 editor. I already integrated this editor on my website and I can use it on new entries. That works, too.
But now there's the problem with existing data. When it comes to the form to update data, I want the existing data being displayed as the value. Everything works fine on all inputs, just the wysihtml5 don't work.
I already know that there's an iframe and that's why I can't set the value of the textarea. I searched for a solution and found the following code (last line):
var editor = new wysihtml5.Editor("textareaid", { // id of textarea element
toolbar: "wysihtml5-toolbar", // id of toolbar element
parserRules: wysihtml5ParserRules, // defined in parser rules set
});
editor.setValue('Here's the content', true);
Usually this should work, but no content appears and the console just tells me:
Error: wysihtml5.Sandbox: Sandbox iframe isn't loaded yet
I tried it with a timeout-function but nothing works. Searching on the internet it also seems that there is noone else with that problem. I hope you can help me out, would be great!
Is there a way to set the value?
This code work for me
$("#product_details").data("wysihtml5").editor.getValue();// to get the value
$("#product_details").data("wysihtml5").editor.setValue('new content')// to set the value
I got the solutions, below code worked for me
$('#id ~ iframe').contents().find('.wysihtml5-editor').html(my_html);
This work for me
$('.wysihtml5-sandbox').contents().find('.wysihtml5-editor').html(my_html);
the ".wysihtml5-sandbox" is a class name of iframe, create by wysihtml5 by default.
I finally got it working by myself. I just change the second parameter of setValue to false. I don't know why, but it works then.
this code worked for me :
var wysihtml5Editor = $('#text_editor').data("wysihtml5").editor;
wysihtml5Editor.setValue("<p>foobar</p>", true);
console.log(wysihtml5Editor.getValue());

How to open and handle richtext editor in javascript in sitecore 6.5?

I've been working on a custom field, which contains a list.
I have to be able to edit the selected item on the list in a richtext editor. (this is the only missing part).
I've read the topic on opening from c# code Opening Rich Text Editor in custom field of Sitecore Content Editor .
This works nice for the "add" button, since i have to open the RTE empty(with default text...), but not for the Edit button.
My aproaches are:
Somehow in the Edit button's message field list:edit(id=$Target) pass the selected index (like list:edit(id=$Target,index=$SelectedIndex), but i don't know how to populate $SelectedIndex
Somehow in the overridden HandleMessage method get the list's selected index. I'm able to get the selected value Sitecore.Context.ClientPage.ClientRequest.Form[ID of list], but thats alone not much of a help, since i won't be able to decide which one to edit if two listitem equals.
Do the richtext editor opening and handling fully in javascript. As i saw at some script in content editor, i tried to do that, but i can't understand it clearly:
richtext editor url:
var page = "/sitecore/shell/Controls/Rich Text Editor/EditorPage.aspx";
some params :
var params = "?da=core&id&ed=" + id + "&vs=1&la=en&fld=" + id + "&so&di=0&hdl=H14074466&us=sitecore%5cadmin&mo";
and the part where i'm not sure:
var result = scForm.browser.showModalDialog(page + params, new Array(window), "dialogHeight:650px; dialogWidth:900px;");
This way the RTE opens as expected (i guess i could get the selected index from javascript and pass it as a parameter later). However when i click ok, i get exception from EditorPage.js saveRichText function: Cannot read property 'ownerDocument' of null. Am i missing some parameter?
Either of the three aproaches is fine for me(also i'm open for new better ones) as soon as i'm able to do it.
Thanks in advance!
Tamas
I was able to enter some javascript into the message:
list:Edit(id=$Target,index='+document.getElementById(ID of the select using $Target ).selectedIndex+')
this way i got the index in HandleMessage.
I'm waiting for better solutions now.

How do I use CKEditor's removeMenuItem() function?

I'm trying to remove the 'paste' option from the right-click menu. There is a recently added function which is supposed to do this, but I'm not sure how to call it.
Documentation: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#removeMenuItem
I've tried the following in CKEditor's config.js file, which don't appear to work:
CKEDITOR.editor.removeMenuItem('paste');
CKEDITOR.editor.prototype.removeMenuItem('paste');
config.removeMenuItem = 'paste'; /* in main config array */
Any suggestions? (Removing right-click menu completely is not an option as I need it for table editing)
Why your tests didn't work:
CKEDITOR.editor.removeMenuItem('paste');
The CKEDITOR object doesn't have a property "editor",
CKEDITOR.editor.prototype.removeMenuItem('paste');
Ditto, and trying to get the prototype won't help.
In both cases you have some error messages waiting for you in the error console
config.removeMenuItem = 'paste'; /* in main config array */
As you have linked, removeMenuItem is a method of the editor object, not a property of the config object.
What you can do:
CKEDITOR.instances.editor.removeMenuItem('paste');
The CKEDITOR object has a property "instances" that contains all the instances, so replace "editor" with the name of your editor and it will work. (of course, after the instance has been created, not before)
You can try this, it worked for me
CKEDITOR.instances.contentEditor.config.removePlugins = 'image,resize';
contentEditor is the name of the instance of CKEDITOR.
You can use the config and set removePlugins and pass a string with the name of the property, that you want to remove. But remember it will only work with those property names, that is present in the plugins object. Like if you want to remove 'paste' you have to do this
CKEDITOR.instances.contentEditor.config.removePlugins = 'pastefromword,pastetext';
When creating the editor in array configuration includes:
var config = {...,
                          'removeButtons': 'Maximize'};
by exzemplo

Resources