}
+public class MultiLineString : String
+{
+ Window OnEdit(DataBox dataBox, DataBox obsolete, int x, int y, int w, int h, void * userData)
+ {
+ // Don't show the editbox right away so that the text is highlighted by default
+ char * string = "";
+ EditBox editBox
+ {
+ dataBox, visible = false,
+ borderStyle = 0,
+ hasHorzScroll = true, hasVertScroll = true,
+ modifyVirtualArea = false,
+ autoSize = dataBox.autoSize;
+ anchor = { 0, 0, 0, 0 };
+ multiLine = true;
+
+ void DataBox::NotifyUpdate(EditBox editBox)
+ {
+ Modified();
+ modifiedDocument = true;
+ }
+
+ bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
+ {
+ opacity = active ? 1.0f : parent.opacity;
+ return true;
+ }
+ };
+ editBox.contents = this;
+ editBox.visible = true;
+
+ editBox.Create();
+ if(!dataBox.active)
+ editBox.contents = this;
+ return editBox;
+ }
+
+ bool OnSaveEdit(Window window, void * object)
+ {
+ bool changed = false;
+ EditBox editBox = (EditBox)window;
+ if(editBox.modifiedDocument)
+ {
+ EditLine line;
+ int size = 0;
+ char * string;
+
+ delete this;
+
+ for(line = editBox.firstLine; line; line = line.next)
+ size += line.count+1;
+ this = string = new char[size+1];
+ size = 0;
+ for(line = editBox.firstLine; line; line = line.next)
+ {
+ memcpy(string + size, line.text, line.count);
+ size += line.count;
+ if(line.next)
+ {
+ string[size] = '\n';
+ size++;
+ }
+ }
+ string[size] = '\0';
+
+ changed = true;
+ }
+ return changed;
+ }
+};
+
__on_register_module()
{
Class baseClass = eSystem_FindClass(module, "class");
}
-public class MultiLineString : String
-{
- Window OnEdit(DataBox dataBox, DataBox obsolete, int x, int y, int w, int h, void * userData)
- {
- // Don't show the editbox right away so that the text is highlighted by default
- char * string = "";
- EditBox editBox
- {
- dataBox, visible = false,
- borderStyle = 0,
- hasHorzScroll = true, hasVertScroll = true,
- modifyVirtualArea = false,
- autoSize = dataBox.autoSize;
- anchor = { 0, 0, 0, 0 };
- multiLine = true;
-
- void DataBox::NotifyUpdate(EditBox editBox)
- {
- Modified();
- modifiedDocument = true;
- }
-
- bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
- {
- opacity = active ? 1.0f : parent.opacity;
- return true;
- }
- };
- editBox.contents = this;
- editBox.visible = true;
-
- editBox.Create();
- if(!dataBox.active)
- editBox.contents = this;
- return editBox;
- }
-
- bool OnSaveEdit(Window window, void * object)
- {
- bool changed = false;
- EditBox editBox = (EditBox)window;
- if(editBox.modifiedDocument)
- {
- EditLine line;
- int size = 0;
- char * string;
-
- delete this;
-
- for(line = editBox.firstLine; line; line = line.next)
- size += line.count+1;
- this = string = new char[size+1];
- size = 0;
- for(line = editBox.firstLine; line; line = line.next)
- {
- memcpy(string + size, line.text, line.count);
- size += line.count;
- if(line.next)
- {
- string[size] = '\n';
- size++;
- }
- }
- string[size] = '\0';
-
- changed = true;
- }
- return changed;
- }
-};
-
public struct DataList : OldList
{
class_data Class type;
void * dataPtr, * data = null, * subData = null;
DataValue valueData, valueSubData;
uint64 bitValue;
+ bool isEditBoxMultiLineContents = false;
// Get main prop
if(dataType.type == structClass)
}
else
{
- GetProperty(prop, object, &valueData);
+ bool freeDataForm = false, freeDataTest = false;
+ // Because contents property is broken for mutiline EditBox at the moment
+ if(!strcmp(prop.name, "contents") && !strcmp(prop._class.name, "EditBox") && ((EditBox)object).multiLine)
+ {
+ isEditBoxMultiLineContents = true;
+ dataType = eSystem_FindClass(((Designer)GetActiveDesigner()).codeEditor.privateModule, "MultiLineString");
+ valueData.p = ((EditBox)object).multiLineContents;
+ dataBox.size.h = 3*(h-2);
+ h = dataBox.clientSize.h;
+ }
+ else
+ GetProperty(prop, object, &valueData);
+
if(dataType.type == normalClass)
dataPtr = valueData.p;
else
delete data;
delete subData;
+ if(isEditBoxMultiLineContents)
+ delete valueData.p;
+
editData.font = { font.faceName, font.size, font.bold };
if(eClass_IsDerived(editData._class, class(DropBox)))
{
mainDataType = prop.dataTypeClass = eSystem_FindClass(((Designer)GetActiveDesigner()).codeEditor.privateModule, prop.dataTypeString);
dataType = mainDataType;
+ // Because contents property is broken for mutiline EditBox at the moment
+ if(!strcmp(prop.name, "contents") && !strcmp(prop._class.name, "EditBox") && ((EditBox)object).multiLine)
+ dataType = eSystem_FindClass(((Designer)GetActiveDesigner()).codeEditor.privateModule, "MultiLineString");
+
// Prepare main prop
if(dataType.type == structClass)
{