Is it possible increase the size of the messageBox. (system.gui.messageBox) The project is running on a tablet and the box is to small for the touch screen. any help would be greatly appreciated.
Thank You!
Dennis
Is it possible increase the size of the messageBox. (system.gui.messageBox) The project is running on a tablet and the box is to small for the touch screen. any help would be greatly appreciated.
Thank You!
Dennis
I donāt believe so. It might be possible to change it from using gui.getOpenWindows() and changing the window size but IDK, that also probably wouldnāt change the size of the button.
Alternatively you could just create a popupwindow as a global resource + a global client script to call it.
Iāve never tried this, but you might can do it with system.gui.transform. Also you should be able to use html in the message box text, increasing the text size might increase the box size too.
Do a search on the forums here for High DPI.
That will lead you to a few solutions depending on your operating system and java version.
Thanks for the suggestion. I tried this to no success. Not quite sure how to code it.
which part, the gui.transform, or the html?
I couldnāt get either way to work. system.gui.warningBox accepts the html, and seems to be larger. It may not be a perfect solution, but it may work for what you need.
I got the font size to change in the message box using html.
message = event.source.text
if message == " ":
system.gui.messageBox(ā āPlease enter in a messageāā)
Changing the size of message box wont work.There is another way and it may take a bit more work, but you can custom make your own message box with the following code. Going this way will allow you to add text boxes, buttons, change font, change size of the message box, etcā¦
[details=Code]from javax.swing import JFrame, JMenuBar, JMenu, JMenuItem, JTextField, JLabel, JButton
from java.awt import BorderLayout,Font
from javax.swing import JOptionPane
frame = JFrame(āMessageā)
frame.setLocation(100,100)
frame.setSize(400,200)
frame.setLayout(BorderLayout())
label = JLabel(āhello worldā)
label.setHorizontalAlignment(JLabel.CENTER)
label.setFont(Font(āCourierā, Font.BOLD,20))
frame.add(label)
frame.setVisible(True)[/details]
Iām new to posting. Wont let me post the html snippit, It takes out all the html so I took out a couple <
[system.gui.messageBox(āhtml> font size=ā20ā>āPlease enter in a messageā/font>ā)]
anyway it works for the font. Not sure how to change the confirm boxes. I tried the java but not sure were to put it in my scripting code and make it a confirm Y or N
To make the custom jframe message reusable, apply the following to a project script:
def doBtn1(event):
import system
system.gui.messageBox("Confirm selected")
def doBtn2(event):
import system
system.gui.messageBox("Deny selected")
def createMessage(title,label,btn1Text,btn2Text):
from javax.swing import JFrame,JLabel, JButton
from java.awt import FlowLayout,Font
frame = JFrame(title)
frame.setSize(400,125)
frame.setLayout(FlowLayout())
label = JLabel(label)
label.setHorizontalAlignment(JLabel.CENTER)
label.setFont(Font("Courier", Font.BOLD,20))
button1 = JButton(btn1Text,actionPerformed=doBtn1)
button1.setSize(100,100)
button2 = JButton(btn2Text,actionPerformed=doBtn2)
button2.setSize(100,100)
frame.add(label)
frame.add(button1)
frame.add(button2)
frame.setVisible(True)
example:
Then where ever you want to call the message box, add the following code.
title = "Message"
label = "Hell World in a custom JFrame"
btn1Text = "Confirm"
btn2Text = "Deny"
project.messageScript.createMessage(title,label,btn1Text,btn2Text)
Setting up the frame title, label, and button labels allows you to dynamically create the message box you need in different situations. You can also add the message box size parameters into the method call and methods created in the project level script to make its size dynamic dependent on what kind of device you are using.
Hope this helps.
Thank you, That got me pointed in the proper directionā¦
Dennis