mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 03:22:39 +08:00
Merge pull request #464 from zilongshanren/fix-editbox-black-screen-issue
fix editbox black screen issue
This commit is contained in:
@@ -6828,6 +6828,16 @@ int
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getBackgroundSprite
|
||||
* @return {ccui.Scale9Sprite}
|
||||
*/
|
||||
getBackgroundSprite : function (
|
||||
)
|
||||
{
|
||||
return ccui.Scale9Sprite;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setPlaceholderFontName
|
||||
* @param {char} arg0
|
||||
|
||||
@@ -17324,6 +17324,28 @@ bool js_cocos2dx_ui_EditBox_setFontSize(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_EditBox_setFontSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_EditBox_getBackgroundSprite(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::EditBox* cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_getBackgroundSprite : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cocos2d::ui::Scale9Sprite* ret = cobj->getBackgroundSprite();
|
||||
JS::RootedValue jsret(cx);
|
||||
if (ret) {
|
||||
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ui::Scale9Sprite>(cx, (cocos2d::ui::Scale9Sprite*)ret));
|
||||
} else {
|
||||
jsret = JSVAL_NULL;
|
||||
};
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_EditBox_getBackgroundSprite : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_EditBox_setPlaceholderFontName(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -17953,6 +17975,7 @@ void js_register_cocos2dx_ui_EditBox(JSContext *cx, JS::HandleObject global) {
|
||||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("getString", js_cocos2dx_ui_EditBox_getText, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setFontSize", js_cocos2dx_ui_EditBox_setFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getBackgroundSprite", js_cocos2dx_ui_EditBox_getBackgroundSprite, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setPlaceholderFontName", js_cocos2dx_ui_EditBox_setPlaceholderFontName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getPlaceHolder", js_cocos2dx_ui_EditBox_getPlaceHolder, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setFontName", js_cocos2dx_ui_EditBox_setFontName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
||||
@@ -887,6 +887,7 @@ void js_register_cocos2dx_ui_EditBox(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_ui_EditBox_getText(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_EditBox_setFontSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_EditBox_getBackgroundSprite(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_EditBox_setPlaceholderFontName(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_EditBox_getPlaceHolder(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_EditBox_setFontName(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
@@ -135,7 +135,6 @@
|
||||
- (void)openKeyboard
|
||||
{
|
||||
[self.window.contentView addSubview:self.textInput];
|
||||
self.window.contentView.wantsLayer = YES;
|
||||
if (![self.textInput isKindOfClass:[NSTextView class]]) {
|
||||
[self.textInput becomeFirstResponder];
|
||||
}else {
|
||||
|
||||
@@ -509,6 +509,11 @@ void EditBox::keyboardDidHide(IMEKeyboardNotificationInfo& info)
|
||||
|
||||
}
|
||||
|
||||
ui::Scale9Sprite* EditBox::getBackgroundSprite() const
|
||||
{
|
||||
return _backgroundSprite;
|
||||
}
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
void EditBox::registerScriptEditBoxHandler(int handler)
|
||||
{
|
||||
@@ -529,4 +534,3 @@ void EditBox::unregisterScriptEditBoxHandler()
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace ui {
|
||||
* Capitalize all characters automatically.
|
||||
*/
|
||||
INITIAL_CAPS_ALL_CHARACTERS,
|
||||
|
||||
|
||||
/**
|
||||
* Lowercase all characters automatically.
|
||||
*/
|
||||
@@ -401,6 +401,8 @@ namespace ui {
|
||||
*/
|
||||
int getMaxLength();
|
||||
|
||||
ui::Scale9Sprite* getBackgroundSprite() const;
|
||||
|
||||
/**
|
||||
* Set the input flags that are to be applied to the edit box.
|
||||
* @param inputFlag One of the EditBox::InputFlag constants.
|
||||
@@ -503,4 +505,3 @@ namespace ui {
|
||||
NS_CC_END
|
||||
|
||||
#endif /* __UIEDITTEXT_H__ */
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version":"v3-deps-19",
|
||||
"version":"v3-deps-20",
|
||||
"zip_file_size":"62588953",
|
||||
"repo_name":"cocos2d-x-lite-external",
|
||||
"repo_parent":"https://github.com/cocos-creator/"
|
||||
|
||||
Reference in New Issue
Block a user