Re: Entry multiline text

James Scholes
 

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.

Regards,

James Scholes

On 26/03/2020 at 8:45 am, Rui Fontes wrote:
Hello!
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)
        dlg.SetValue("")
        if dlg.ShowModal() == wx.ID_OK:
            nBlock = dlg.GetValue()
        else:
            dlg.Destroy()
            return
        if nBlock != "":
            global name
            global newBlock
            newBlock.append(nBlock)
            if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                self._addBlock()
                return
        else:
            dlg.Destroy()
            return
Best regards,
Rui Fontes
NVDA portuguese team

Join nvda-addons@nvda-addons.groups.io to automatically receive all group messages.