Yast UI
YMultiLineEdit Class Reference

multiple line text edit field More...

Detailed Description

multiple line text edit field

Following widget variants exist: MultiLineEdit

Example:

# encoding: utf-8
module Yast
class MultiLineEdit1Client < Client
def main
Yast.import "UI"
UI.OpenDialog(
VBox(MultiLineEdit("Problem &description:"), PushButton("&OK"))
)
UI.UserInput
UI.CloseDialog
nil
end
end
end
Yast::MultiLineEdit1Client.new.main

Example:

# encoding: utf-8
module Yast
class MultiLineEdit2Client < Client
def main
Yast.import "UI"
# Build dialog with one multi line edit field and an OK button.
UI.OpenDialog(
VBox(
HSpacing(60), # force width
HBox(
VSpacing(7), # force height
MultiLineEdit(
Id(:problem),
"Problem &description:", # label
"No problem here"
)
),
PushButton("&OK")
)
)
# Wait for user input.
UI.UserInput
# Get the input from the MultiLineEdit.
#
# Notice: The return value of UI::UserInput() does NOT return this value!
# Rather, it returns the ID of the widget (normally the PushButton)
# that caused UI::UserInput() to return.
@input = Convert.to_string(UI.QueryWidget(Id(:problem), :Value))
# Close the dialog.
# Remember to read values from the dialog's widgets BEFORE closing it!
UI.CloseDialog
# Pop up a new dialog to echo the input.
UI.OpenDialog(
VBox(Label("You entered:"), Label(@input), PushButton("&OK"))
)
UI.UserInput
UI.CloseDialog
nil
end
end
end
Yast::MultiLineEdit2Client.new.main

Example:

# encoding: utf-8
# Build dialog with MuliLineEdit widget,
# a character counter for the MuliLineEdit's contents as they are typed
# and an OK button.
module Yast
class MultiLineEdit3Client < Client
def main
Yast.import "UI"
UI.OpenDialog(
VBox(
MultiLineEdit(
Id(:problem),
Opt(:notify), # make UI::UserInput() return on every keystroke
"Problem &description:"
),
HBox(
Label("Number of characters entered:"),
Label(Id(:char_count), "0 ")
),
PushButton(Id(:ok), "&OK")
)
)
@ret = nil
begin
# Wait for user input.
#
# Since the MultiLineEdit is in "notify" mode, it, too, will cause
# UI::UserInput() to return upon any single character entered.
@ret = UI.UserInput
if @ret == :problem # User typed some text
# Set the `char_count label to the number of characters entered
# into the MultiLineEdit widget.
UI.ChangeWidget(
Id(:char_count),
:Value,
Builtins.sformat(
"%1",
Builtins.size(
Convert.to_string(UI.QueryWidget(Id(:problem), :Value))
)
)
)
end
end while @ret != :ok
# Get the input from the MultiLineEdit.
#
# Notice: The return value of UI::UserInput() does NOT return this value!
# Rather, it returns the ID of the widget (normally the PushButton)
# that caused UI::UserInput() to return.
@input = Convert.to_string(UI.QueryWidget(Id(:problem), :Value))
# Close the dialog.
# Remember to read values from the dialog's widgets BEFORE closing it!
UI.CloseDialog
# Pop up a new dialog to echo the input.
UI.OpenDialog(
VBox(Label("You entered:"), Label(@input), PushButton("&OK"))
)
UI.UserInput
UI.CloseDialog
nil
end
end
end
Yast::MultiLineEdit3Client.new.main

Example:

# encoding: utf-8
module Yast
class MultiLineEditSetInputMaxLengthClient < Client
def main
Yast.import "UI"
UI.OpenDialog(
VBox(
MultiLineEdit(Id(:input), "Multi Line Edit", "pizza\npasta\npronta"),
IntField(Id(:field), "Limit characters to...", -1, 100, -1),
PushButton(Id(:butt), "limit input"),
PushButton(Id(:exitButton), "Exit")
)
)
@ret = nil
@ret = UI.UserInput
while @ret != :exitButton
@chars = Convert.to_integer(UI.QueryWidget(Id(:field), :Value))
UI.ChangeWidget(:input, :InputMaxLength, @chars)
@ret = UI.UserInput
end
UI.CloseDialog
nil
end
end
end
Yast::MultiLineEditSetInputMaxLengthClient.new.main

This widget is a multiple line text entry field with a label above it. An initial text can be provided.

Note: You can and should set a keyboard shortcut within the label. When the user presses the hotkey, the corresponding MultiLineEdit widget will get the keyboard focus.


The documentation for this class was generated from the following file: