Closed FredericChow00 closed 1 year ago
@FredericChow00 Could you share a screenshot of the GUI to illustrate the problem you are referring to?
@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
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.
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.
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.
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.
Select the stuck nodes in SceneBuilder, and bind their sides to the appropriate borders of the AnchorPane
:
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.
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.
You can try setting the Min. height of the Dialog Box
to USE_PREF_SIZE
After doing that, for mine, the ellipses are gone and the remaining text shows. :)
Good luck!!
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:
private static final int LINE_LIMIT = 45;
private static final int LINE_HEIGHT = 30;
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.
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
Personally for Label I set USE_COMPUTED_SIZE for all as shown
this is the way long texts are shown
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! :)
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?