Git Product home page Git Product logo

Comments (5)

tboeckel avatar tboeckel commented on August 28, 2024

HardWrap is definitely the default value. See here:

data->WrapMode = MUIV_TextEditor_WrapMode_HardWrap;

I'll have to check whether specifying or omitting MUIA_TextEditor_WrapMode during OM_NEW makes any difference or not.

from texteditor.

tboeckel avatar tboeckel commented on August 28, 2024

Well, according to a quick test data->WrapMode stays MUIV_TextEditor_WrapMode_HardWrap all the time when it is not explicitly defined at OM_NEW time, at least the value is correct. And hence I assume the behaviour also corresponds to that value.
Have you tried OM_GET'ing it already when you think it has the wrong value?

from texteditor.

tboeckel avatar tboeckel commented on August 28, 2024

Any comment on this issue?

from texteditor.

afalkenhahn avatar afalkenhahn commented on August 28, 2024

Seems I forgot about this. Try the attached example. Enter enough words to make TextEditor wrap the line. Then hit the button. You'll see that no newline characters have been inserted. In other words: Softwrapping has been used.

#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>

#include <exec/exec.h>
#include <exec/types.h>

#include <intuition/intuition.h>

#include <libraries/mui.h>

#include <mui/TextEditor_mcc.h>

#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/muimaster.h>
#include <proto/utility.h>

struct Library *MUIMasterBase = NULL;
struct MUIMasterIFace *IMUIMaster = NULL;

struct Library *IntuitionBase = NULL;
struct IntuitionIFace *IIntuition = NULL;

int main(int argc, char *argv[])
{
	Object *win, *app, *bt, *str;
	ULONG sigs = 0;
	ULONG id;
	int flag = 0;
	Object *subwin, *parent, *reg;

	IntuitionBase = (struct Library *) OpenLibrary("intuition.library", 0);
	IIntuition = (struct IntuitionIFace *) GetInterface(IntuitionBase, "main", 1, NULL);

	MUIMasterBase = OpenLibrary("muimaster.library", 0);
	IMUIMaster = (struct MUIMasterIFace *) GetInterface(MUIMasterBase, "main", 1, NULL);

	app = ApplicationObject,
		MUIA_Application_Title, "Foo",
		MUIA_Application_Base, "xxxxx",

		SubWindow, win = WindowObject,
			MUIA_Window_Title, "Bar",

			WindowContents, VGroup,

				Child, VGroup,
				
					Child, str = TextEditorObject,
						MUIA_TextEditor_Contents, "x",
					End,

					Child, VGroup,
						Child, bt = SimpleButton("Click me"),
					End,
				End,
			End,
		End,
	End;

	DoMethod(win, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
	DoMethod(bt, MUIM_Notify, MUIA_Pressed, FALSE, app, 2, MUIM_Application_ReturnID, 1001);

	set(win, MUIA_Window_Open, TRUE);

	while((id = DoMethod(app,MUIM_Application_NewInput,&sigs)) != MUIV_Application_ReturnID_Quit) {

		if(id == 1001) {

			STRPTR s = DoMethod(str, MUIM_TextEditor_ExportText);

			printf("HMM: %s\n", s);
			FreeVec(s);
		}

		if(sigs) {
			sigs = Wait(sigs | SIGBREAKF_CTRL_C);
			if (sigs & SIGBREAKF_CTRL_C) break;
		}
	}

	MUI_DisposeObject(app);

	if(IIntuition) DropInterface((struct Interface *) IIntuition);
	if(IMUIMaster) DropInterface((struct Interface *) IMUIMaster);

	if(MUIMasterBase) CloseLibrary(MUIMasterBase);
	if(IntuitionBase) CloseLibrary(IntuitionBase);

	return 0;
} 

from texteditor.

tboeckel avatar tboeckel commented on August 28, 2024

Ah, yes, now I get it!

It seems you did not read the documentation carefully enough. It is clearly stated that MUIV_TextEditor_WrapMode_HardWrap requires MUIA_TextEditor_WrapBorder to be set to a non-zero value to work. However, the default value of MUIA_TextEditor_WrapBorder is zero and hence effectively disables hard wrapping. As soon as MUIA_TextEditor_WrapBorder ist set to i.e. 20 you will get the desired result.

from texteditor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.