Re: Entry multiline text

Rui Fontes

Hello James,

I read that, and I was asking which alternative I should use...

And, by the way, it seems that is possible to use multiline with it...

Read on:

specially this part:

Object of this class displays a dialog with one text field, a customizable label prompting the user to input and two buttons with predefined styles.
Although this dialog requests a one line input, the text box can be customized by using TextCtrl styles like password and multiline.
Contents of the text field are collected as return value when the user clicks OK button.

But if I include the parameter style=wx.TE_MULTILINE, the text field becomes multiline but the buttons disappear...

Best regards,

Rui Fontes

NVDA portuguese team

Às 15:09 de 26/03/2020, James Scholes escreveu:

The first line of the documentation for wx.TextEntryDialog states:

This class represents a dialog that requests a one-line text string
from the user.

So there is no way to prompt users for multiple lines using this helper.  But just replace it with a modal that has a label, a multi-line wx.TextCtrl and OK/Cancel buttons.


James Scholes

On 26/03/2020 at 8:45 am, Rui Fontes wrote:

I have the following function to collect a multiline block of text.

It is possible to replace it by a function that collects the all block at once?

     def _addBlock(self):
         # Translators: Message dialog box to add a new block of text.
         dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the block of text"), self.title)
         if dlg.ShowModal() == wx.ID_OK:
             nBlock = dlg.GetValue()
         if nBlock != "":
             global name
             global newBlock
             if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:

Best regards,

Rui Fontes

NVDA portuguese team

Join to automatically receive all group messages.