nus-cs2103-AY2223S2 / forum

12 stars 0 forks source link

Advice on how to split up long replies by Duke #161

Closed FredericChow00 closed 1 year ago

FredericChow00 commented 1 year ago

Initially I tried to tackle this issue by tracking the number of lines that Duke replies and if the number of lines goes over a certian threshold, then I create a new dialogueContainer.

But that seems to not work in some cases. I feel like I should judge when to create a new dialogueContainer based on how long the replies are (like the height?) instead of how many sentences but I'm not sure how to do that

Any advice?

damithc commented 1 year ago

@FredericChow00 Could you share a screenshot of the GUI to illustrate the problem you are referring to?

FredericChow00 commented 1 year ago

@damithc

For the 4th task, theres more to the event "study" but it doesnt complete because the dialogueContainer is too small. I'm trying to find a way such that the extra words would spill into the next dialogueContainer

image

nus-se-bot commented 1 year ago

Tagging a few other students (randomly selected) who have completed related increments, in case they can help: @toh-xinyi @weekiat-douze @valerietanhx @cyiting @Gibson0918 @gwynethguo @jefrai @jereldlimjy @TabrizPlv @kennycjy @noahxinjie @KevinEyo1 @clevon-w @gitsac @bryansendeavour Others are welcome to pitch in too.

weekiat-douze commented 1 year ago

Hi, I believe it's because one of the dialog views have a fixed height. You can try to set it to "computed" via SceneBuilder if I'm not wrong.

hingen commented 1 year ago

Perhaps instead of creating a new DialogBox, you could consider having the label of DialogBox.fxml scale with the input. Not sure if this would allow you to do so since the way to do it depends on how your fxml is structured.

jefrai commented 1 year ago

It's difficult for the program to tell exactly which words are cut off - JavaFX doesn't provide a way to retrieve that info from its nodes. Instead, you might want to make the whole GUI resizable so that the user can drag it horizontally to see longer messages:

Try to resize your GUI as it is - some nodes should follow the new borders nicely, while others will stay stuck in their original positions.

0Capture

Select the stuck nodes in SceneBuilder, and bind their sides to the appropriate borders of the AnchorPane:

2Capture

Some nodes in DialogBox might need to have their heights and widths changed as well. Once all nodes scale correctly, the GUI should be able to expand and display longer text.

3Capture

gwynethguo commented 1 year ago

I have just encountered this problem. Try to use TextFlow instead of Label. If you still encounter problems regarding this, you can see the commits that I have pushed for A-BetterGui increment.

toh-xinyi commented 1 year ago

You can try setting the Min. height of the Dialog Box to USE_PREF_SIZE image After doing that, for mine, the ellipses are gone and the remaining text shows. :) Good luck!!

SPWwj commented 1 year ago

One alternative way is to use dialog.setMinHeight(); to adjust the dialog text to the require height. We can create two attributes to calculate the height width and height limit:

Next just create a helper function to format the text: formatInput(String input) Then we can dynamically configure the dialogbox attritrube in its contructor. dialog.setMinHeight(dialogBoxInput.getLineNumber() * LINE_HEIGHT); You may refer to my code for more info.

TabrizPlv commented 1 year ago

It appears that you are using another DialogBox to account for lists that are too long. However, instead of creating another DialogBox you can actually scale the height of your Label so that it will stretch to fit events that are too long in length. The approach to this is similar to the one mentioned by @toh-xinyi, but we apply it to the Label instead. Refer to the Layout properties

image

bryansendeavour commented 1 year ago

Personally for Label I set USE_COMPUTED_SIZE for all as shown

Screenshot 2023-02-13 at 12 49 57 PM

this is the way long texts are shown

Screenshot 2023-02-13 at 12 52 10 PM
Hikoya commented 1 year ago

Hello @FredericChow00 , I'm a senior from a previous batch, is there any updates to this issue? If the issue has been resolved, please remember to close the issue! :)