x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

how to make working notebook/notes system in ue4?

hi,

I'm trying to make a system where player can have a book and write and store any text in that notebook. But i'm not sure how to implement the same.Any help in the same direction would be appreciated. Can the same system can be achieved with blueprints?Thank you.

Product Version: UE 4.19
Tags:
more ▼

asked Sep 03 '18 at 07:17 AM in C++ Programming

avatar image

karti047
5 3 4

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

This should be easily achievable in pure UMG unless you need some fancy formatting, like text flowing around images.

For something super simple, I'd create 2 widgets. A book and a book page. A book would have a Widget Switcher and some controls to flip pages by index, a page would have a Multi Line Editable Text (or Text Box).

more ▼

answered Sep 03 '18 at 08:00 AM

avatar image

Everynone
13.7k 74 25 57

avatar image karti047 Sep 03 '18 at 09:39 AM

Thanks for the information. I haven't tried your way but experimented with multi line editable text. But the way it works is like there is no limit for number of lines and also if you keep entering data then it keeps reading them in single horizontal line unless you press enter. Is there a way to fix the number of characters per line and also set total lines for each multi line text ?Thank you.

avatar image Everynone Sep 03 '18 at 10:03 AM

If you keep entering data then it keeps reading them in single horizontal line unless you press enter

This ought to do it:

alt text

But the way it works is like there is no limit for number of lines

Override the OnTextChange and check whether the text box' Y is larger than the container's it is nested in. If it is, create a new new page.

Let me know if any this refuses to work as you envisioned. From my own experience, there is a limit to what UMG can do. So far, it all sounds fairly blueprintable.

wrap.png (7.7 kB)
avatar image karti047 Sep 04 '18 at 06:59 AM

Thanks a lot.I'll update to you on the same as soon as i can.Thank you.

avatar image karti047 Sep 05 '18 at 03:59 AM

Hey thanks a lot. So far all 'blue printable'!.It works just fine. I thought of adding a bullet at the beginning whenever the text entered in the new line.Any thoughts?

avatar image Everynone Sep 05 '18 at 08:26 AM
  • As in every line has a bullet? (makes little sense, but still, who knows)

  • Or every entry has a bullet? (so a multi-line chunk of text would have a bullet and offset text)

  • Does an empty page have any bullets?

  • The bullet appears when the widget is clicked and the user is ready to type?

Unsure how you envisioned it. Consider share some details regarding the functionality and I'll try to chip in as it all sounds doable.


You may want another custom widget here that encapsulates some behaviour and serves as a page entry. So the book stores page widgets while the pages store entry widgets.

avatar image karti047 Sep 06 '18 at 03:27 AM

Yeah. I hope you used Microsoft word. In that the bullet pops up(if enabled) only whenever you press Enter key(So when the player goes to next line automatically there is no bullet). I'm looking for the same effect by default(no enabling). Is that possible?Also right now i'm experimenting with single page entry.Thank you for the help.

avatar image Everynone Sep 06 '18 at 08:29 AM

Yeah, that should work. As soon as the player hits enter, create a new widget with a bullet and add it to the page. The page would need to be a vertical box. So you will need 3 widgets in total for this.

avatar image karti047 Sep 06 '18 at 09:42 AM

Okay,but how exactly you get the position because the way its working right now is that all the text will be in the multi line text box(call it widget_1). From what i understood by your answer is that when the Enter key is pressed another widget(widget_2) should be added to view port. But how exactly you know the position to spawn that widget?Correct me if i'm getting this totally wrong.Thank you.

avatar image Everynone Sep 06 '18 at 10:55 AM

But how exactly you know the position to spawn that widget?Correct me if i'm getting this totally wrong.Thank you.

You don't need to. As I mentioned above, each page is a vertical box, so you just add a new entry to that vertical box and it will be automagically placed underneath.

And then, if the vertical box' size would exceed the size of the page, create a new page and add the widget to that new page's vertical box instead.


Here's an example of something quite similar I answered this morning: https://answers.unrealengine.com/questions/825489/how-to-configure-a-text-box-and-zoom-box-for-such.html

In your case, each of those entries would contain a horizontal box with an image of the bullet and text occupying the rest of the remaining space.

Does it make sense? I feel like I'm not explaining it well.

avatar image karti047 Sep 07 '18 at 03:59 AM

Yeah it makes sense.I'll try out and get back to you.Thank you.

avatar image karti047 Sep 07 '18 at 05:37 AM

Hey Thanks a lot. It works but have one problem. Any idea how to set the input mode? because whenever i'm typing the input game mode is set to game and UI and because of that i have to come out of the widget(click somewhere else to go out of widget) then have to press Enter. If i press Enter while still typing then it just goes to next line.Thank you.

avatar image Everynone Sep 07 '18 at 05:56 PM

Hold on, you want the widget to lose focus as soon as you hit enter while typing? Lose focus or leave the widget? You lost me there :|

avatar image karti047 Sep 08 '18 at 03:03 AM

Currently i need to come out of the widget(Click somewhere else) and then have to press Enter in order to pop up the next bulletin. otherwise it simply goes to the next line int the same text box. Also you have any idea to make the cursor appear at the beginning of the widget(page in this case)?In my case it appears in the exact second line of the first bulletin if there are multiple bulletins.The below is the screenshot of the same.I just want the cursor to appear above.Thank you.

[1]: /storage/temp/253082-bullet.png

bullet.png (1.4 MB)
avatar image Everynone Sep 10 '18 at 07:26 AM

Sorry for the delay. Persistent hardware issues. No editor access so it's straight from the top of my head. You've been warned! ;)

Currently i need to come out of the widget(Click somewhere else) and then have to press Enter in order to pop up the next bulletin. otherwise it simply goes to the next line int the same text box.

If you're using multiline nodes for this (as you should), they come with commit events you can override. What would work on a normal editable box beautifully, does not work with multilines as the Enter key simply moves the caret to a new line.

What will work in this situation is catching the enter key before it reaches the multiline box.

In the widget that has the multiline, override onPreviewKey > get key > compare to enter > if true > call a custom event of your choice > pass Handled as the return value. If not true, pass Unhandled.

This will prevent the multiline box from processing Enter, allow you to catch it and execute something else instead via a custom event - create a new widget, for example.

Also you have any idea to make the cursor appear at the beginning of the widget(page in this case)?In my case it appears in the exact second line of the first bulletin if there are multiple bulletins.

Not sure if I get this one. When you click in the widget that has some text already you want to cursor to appear at the beginning of the text?

avatar image karti047 Sep 20 '18 at 02:31 AM

Hey really sorry for not replying. I've been travelling and today i'm back. I did use the On Preview Key and it works as you explained.

@ Not sure if I get this one. When you click in the widget that has some text already you want to cursor to appear at the beginning of the text?

Ya,for example when you open a notepad after some typing some text the cursor will be at the beginning. I wanna implement similar to that(if i type something and close it and then open the same the cursor should be at the beginning of the first line). In the image i sent above the cursor appears below hello line.I want it to appear at the beginning of hello line.Let me know if you didn't understand this point.Thank you.

avatar image Everynone Sep 25 '18 at 07:11 AM

I added a comment but it was picked up by an overly-sensitive moderation filter, it will be here once it's reviewed. That, or I'm getting banned! :]

avatar image karti047 Sep 25 '18 at 11:01 AM

okay,that sounds not good.Anyways hey can you tell is there anyway we can determine the end of the page?Like if you keep entering the data and reaches the bottom (right now it keeps on adding new entries when Enter pressed)then automatically move to the next page?Thank you.

avatar image Everynone Sep 25 '18 at 11:22 AM

Ideally, check what size the vertical box housing the entries would expand to before it actually expands.

As you keep adding new entries to a Vertical Box, the VB keeps expanding. Normally, before you add a new entry, you'd compare the size of the VB + Entry size against the size of the page. If the newVB size would to exceed the page size, add the new entry to the next page instead.

However, since each entry can have a different size and you only know the desired entry size after the user has punched in the text, you may need to compare container sizes after adding the entry.

Pseudo code:

  • add the new entry as you normally would

  • check if the VB size exceeds the page size now

  • if it does not, fine, you have space left, do nothing else

  • if it does exceed and would cause overlapping:
    • create a new page

    • re-parent the offending entry by adding it as a child to the next page's VB

The last bit above will remove the entry from the last page (where it overlaps) and add it to the next page automatically. A widget can only have one direct parent at a time - take advantage of that.

Since this will happen within the same frame, you should not see a glitch when the container expends beyond the size of the page and then shrinks back.

If it does, do let me know, there will be a way to counter that.

avatar image Everynone Sep 26 '18 at 12:14 PM

I just saw you marked it as resolved. Was going to get back to you and it slipped my mind... Bugger.

Ya,for example when you open a notepad after some typing some text the cursor will be at the beginning. I wanna implement similar to that(if i type something and close it and then open the same the cursor should be at the beginning of the first line).

Does it automatically appear in the second line?

I think this might be a limitation of the UMG at the point; as in, you may not have direct control over the position of the caret. A couple of things you could try:

  • figure out why the cursor goes to the second line in the first place - user action or automatic. If it's user action, there might be a way to catch that action and override it (like you did with enter). If it automatically goes to the second line, perhaps the onPreviewKey is not passing Handled / Unhandled correctly.

  • clean up the text - convert to string, trim trailing spaces, put the trimmed text back in the box

  • manually set focus to the widget when opening the page; in theory, this should place the cursor at the beginning / end of the text line, rather than in a new one

  • unlikely, but perhaps the cursor going to the second line is the result of text wrapping?

Judging by your description, I'd say there is an issue with passing Handled / Unhandled - could you show a screenshot of that? Somehow I feel that the box still processes that key. But please do correct me if I'm mistaken.


the cursor should be at the beginning of the first line

I'm not getting why you'd want that, shouldn't it be at the end of the line - so the user can continue typing where they left off? Or is this a conscious design choice, which is, of course, understandable.

avatar image karti047 Sep 27 '18 at 01:19 AM

Thanks a lot.I'll try and get back to you asap.

avatar image karti047 Sep 27 '18 at 06:24 AM

hey,i tried checking up the size of vertical box when the punch was made. It works and says the page is full if the size exceeds the specified size(Ex:size=300). The following screenshot is attached below. But the one issue i got was if you try to edit the(give input) text boxes then that box keeps on expanding. Is there any way you can stop reading the input when it reaches the end of the line so no further expansion occurs?

I've uploaded the video below. Just want to stop reading the input after the end of first line(Last S).

@ Does it automatically appear in the second line?

Ya it appears at the second line if text box contains 2 lines or more number of text. I thought the notepad cursor appearance style(at the beginning of the line) would add more sophistication. I'll try what you mentioned and get back to you later on that.

Thank you. link text

sizelogic.png (531.3 kB)
(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question