Assigning window height and width programatically
All,
Is it possible to assign window height and width programatically?? ie through editor in SAP scripts.
Hi
Yes you can
POSITION WINDOW
SIZE WIDTH '160' MM HEIGHT '140' MM
BOX FRAME 10 TW
Box
BOX HEIGHT '11' MM WIDTH '160' MM FRAME 10 TW INTENSITY 35
linessssssss
BOX XPOS '20' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '45' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '80' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '120' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
Boxes, Lines, Shading: BOX, POSITION, SIZE
Use the BOX, POSITION, and SIZE commands for drawing boxes, lines, and shading to print particular windows within a form or passages of text within a window in a frame or with shading.
The SAP printer drivers that are based on page-oriented printers (the HP LaserJet driver HPL2, the Postscript driver POST, the Kyocera Prescribe driver PRES) employ these commands when printing. Line printers and page-oriented printers not supported in the standard ignore these commands. You can view the resulting printer output in the SAPscript print preview.
Syntax:
/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
/: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
BOX Command
Syntax
/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
Effect: draws a box of the specified size at the specified position.
Parameters: For each of XPOS, YPOS, WIDTH, HEIGHT, and FRAME, you must specify both a measurement and a unit of measurement. Specify the INTENSITY parameter as a percentage between 0 and 100.
XPOS, YPOS
Upper left corner of the box, relative to the values of the POSITION command.
Default: Values specified in the POSITION command.
The following calculation is performed internally to determine the absolute output position of a box on the page:
X(abs) = XORIGIN + XPOS
Y(abs) = YORIGIN + YPOS
WIDTH
Width of the box. Default: WIDTH value of the SIZE command.
HEIGHT
Height of the box. Default: HEIGHT value of the SIZE command.
FRAME
Thickness of frame.
Default: 0 (no frame).
INTENSITY
Grayscale of box contents as %.
Default: 100 (full black)
Measurements: You must specify decimal numbers as literal values (like ABAP numeric constants) by enclosing them in inverted commas. Use the period as the decimal point character. See also the examples listed below.
Units of measurement: The following units of measurement may be used:
TW (twip)
PT (point)
IN (inch)
MM (millimeter)
CM (centimeter)
LN (line)
CH (character).
The following conversion factors apply:
1 TW = 1/20 PT
1 PT = 1/72 IN
1 IN = 2.54 CM
1 CM = 10 MM
1 CH = height of a character relative to the CPI specification in the form header
1 LN = height of a line relative to the LPI specification in the form header
/: BOX FRAME 10 TW
Draws a frame around the current window with a frame thickness of 10 TW (= 0.5 PT).
/: BOX INTENSITY 10
Fills the window background with shading having a gray scale of 10 %.
/: BOX HEIGHT 0 TW FRAME 10 TW
Draws a horizontal line across the complete top edge of the window.
/: BOX WIDTH 0 TW FRAME 10 TW
Draws a vertical line along the complete height of the left hand edge of the window.
/: BOX WIDTH '17.5' CM HEIGHT 1 CM FRAME 10 TW INTENSITY 15
/: BOX WIDTH '17.5' CM HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '10.0' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '13.5' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
Draws two rectangles and two lines to construct a table of three columns with a highlighted heading section.
POSITION Command
Syntax
/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
Effect: Sets the origin for the coordinate system used by the XPOS and YPOS parameters of the BOX command. When a window is first started, the POSITION value is set to refer to the upper left corner of the window (default setting).
Parameters: If a parameter value does not have a leading sign, then its value is interpreted as an absolute value, in other words, as a value that specifies an offset from the upper left corner of the output page. If a parameter value is specified with a leading sign, then the new value of the parameter is calculated relative to the old value. If one of the parameter specifications is missing, then no change is made to this parameter.
XORIGIN, YORIGIN
Origin of the coordinate system.
WINDOW
Sets the values for the left and upper edges to match those of the current window (default setting).
PAGE
Sets the values for the left and upper edges to match those of the current output page (XORIGIN = 0 cm, YORIGIN = 0 cm).
/: POSITION WINDOW
Sets the origin for the coordinate system to the upper left corner of the window.
/: POSITION XORIGIN 2 CM YORIGIN '2.5 CM'
Sets the origin for the coordinate system to a point 2 cm from the left edge and 2.5 cm from the upper edge of the output page.
/: POSITION XORIGIN '-1.5' CM YORIGIN -1 CM
Shifts the origin for the coordinates 1.5 cm to the left and 1 cm up.
SIZE Command
Syntax
/: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
Effect: Sets the values of the WIDTH and HEIGHT parameters used in the BOX command. When a window is first started, the SIZE value is set to the same values as the window itself (default setting).
Parameters: If one of the parameter specifications is missing, then no change is made to the current value of this parameter. If a parameter value does not have a leading sign, then its value is interpreted as an absolute value. If a parameter value is specified with a leading sign, then the new value of the parameter is calculated relative to the old value.
WIDTH, HEIGHT
Dimensions of the rectangle or line.
WINDOW
Sets the values for the width and height to the values of the current window (default setting).
PAGE
Sets the values for the width and height to the values of the current output page.
/: SIZE WINDOW
Sets WIDTH and HEIGHT to the current window dimensions.
/: SIZE WIDTH '3.5' CM HEIGHT '7.6' CM
Sets WIDTH to 3.5 cm and HEIGHT to 7.6 cm.
/: POSITION WINDOW
/: POSITION XORIGIN -20 TW YORIGIN -20 TW
/: SIZE WIDTH +40 TW HEIGHT +40 TW
/: BOX FRAME 10 TW
A frame is added to the current window. The edges of the frame extend beyond the edges of the window itself, so as to avoid obscuring the leading and trailing text characters.
http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
SAPScripts
POSITION WINDOW
SIZE WIDTH '160' MM HEIGHT '140' MM
BOX FRAME 10 TW
Box
BOX HEIGHT '11' MM WIDTH '160' MM FRAME 10 TW INTENSITY 35
linessssssss
BOX XPOS '20' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '45' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '80' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '120' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
Boxes, Lines, Shading: BOX, POSITION, SIZE
Use the BOX, POSITION, and SIZE commands for drawing boxes, lines, and shading to print particular windows within a form or passages of text within a window in a frame or with shading.
The SAP printer drivers that are based on page-oriented printers (the HP LaserJet driver HPL2, the Postscript driver POST, the Kyocera Prescribe driver PRES) employ these commands when printing. Line printers and page-oriented printers not supported in the standard ignore these commands. You can view the resulting printer output in the SAPscript print preview.
Syntax:
/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
/: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
BOX Command
Syntax
/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
Effect: draws a box of the specified size at the specified position.
Parameters: For each of XPOS, YPOS, WIDTH, HEIGHT, and FRAME, you must specify both a measurement and a unit of measurement. Specify the INTENSITY parameter as a percentage between 0 and 100.
XPOS, YPOS
Upper left corner of the box, relative to the values of the POSITION command.
Default: Values specified in the POSITION command.
The following calculation is performed internally to determine the absolute output position of a box on the page:
X(abs) = XORIGIN + XPOS
Y(abs) = YORIGIN + YPOS
WIDTH
Width of the box. Default: WIDTH value of the SIZE command.
HEIGHT
Height of the box. Default: HEIGHT value of the SIZE command.
FRAME
Thickness of frame.
Default: 0 (no frame).
INTENSITY
Grayscale of box contents as %.
Default: 100 (full black)
Measurements: You must specify decimal numbers as literal values (like ABAP numeric constants) by enclosing them in inverted commas. Use the period as the decimal point character. See also the examples listed below.
Units of measurement: The following units of measurement may be used:
TW (twip)
PT (point)
IN (inch)
MM (millimeter)
CM (centimeter)
LN (line)
CH (character).
The following conversion factors apply:
1 TW = 1/20 PT
1 PT = 1/72 IN
1 IN = 2.54 CM
1 CM = 10 MM
1 CH = height of a character relative to the CPI specification in the form header
1 LN = height of a line relative to the LPI specification in the form header
/: BOX FRAME 10 TW
Draws a frame around the current window with a frame thickness of 10 TW (= 0.5 PT).
/: BOX INTENSITY 10
Fills the window background with shading having a gray scale of 10 %.
/: BOX HEIGHT 0 TW FRAME 10 TW
Draws a horizontal line across the complete top edge of the window.
/: BOX WIDTH 0 TW FRAME 10 TW
Draws a vertical line along the complete height of the left hand edge of the window.
/: BOX WIDTH '17.5' CM HEIGHT 1 CM FRAME 10 TW INTENSITY 15
/: BOX WIDTH '17.5' CM HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '10.0' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '13.5' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
Draws two rectangles and two lines to construct a table of three columns with a highlighted heading section.
POSITION Command
Syntax
/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
Effect: Sets the origin for the coordinate system used by the XPOS and YPOS parameters of the BOX command. When a window is first started, the POSITION value is set to refer to the upper left corner of the window (default setting).
Parameters: If a parameter value does not have a leading sign, then its value is interpreted as an absolute value, in other words, as a value that specifies an offset from the upper left corner of the output page. If a parameter value is specified with a leading sign, then the new value of the parameter is calculated relative to the old value. If one of the parameter specifications is missing, then no change is made to this parameter.
XORIGIN, YORIGIN
Origin of the coordinate system.
WINDOW
Sets the values for the left and upper edges to match those of the current window (default setting).
PAGE
Sets the values for the left and upper edges to match those of the current output page (XORIGIN = 0 cm, YORIGIN = 0 cm).
/: POSITION WINDOW
Sets the origin for the coordinate system to the upper left corner of the window.
/: POSITION XORIGIN 2 CM YORIGIN '2.5 CM'
Sets the origin for the coordinate system to a point 2 cm from the left edge and 2.5 cm from the upper edge of the output page.
/: POSITION XORIGIN '-1.5' CM YORIGIN -1 CM
Shifts the origin for the coordinates 1.5 cm to the left and 1 cm up.
SIZE Command
Syntax
/: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
Effect: Sets the values of the WIDTH and HEIGHT parameters used in the BOX command. When a window is first started, the SIZE value is set to the same values as the window itself (default setting).
Parameters: If one of the parameter specifications is missing, then no change is made to the current value of this parameter. If a parameter value does not have a leading sign, then its value is interpreted as an absolute value. If a parameter value is specified with a leading sign, then the new value of the parameter is calculated relative to the old value.
WIDTH, HEIGHT
Dimensions of the rectangle or line.
WINDOW
Sets the values for the width and height to the values of the current window (default setting).
PAGE
Sets the values for the width and height to the values of the current output page.
/: SIZE WINDOW
Sets WIDTH and HEIGHT to the current window dimensions.
/: SIZE WIDTH '3.5' CM HEIGHT '7.6' CM
Sets WIDTH to 3.5 cm and HEIGHT to 7.6 cm.
/: POSITION WINDOW
/: POSITION XORIGIN -20 TW YORIGIN -20 TW
/: SIZE WIDTH +40 TW HEIGHT +40 TW
/: BOX FRAME 10 TW
A frame is added to the current window. The edges of the frame extend beyond the edges of the window itself, so as to avoid obscuring the leading and trailing text characters.
http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
SAPScripts
POSITION WINDOW
SIZE WIDTH '160' MM HEIGHT '140' MM
BOX FRAME 10 TW
Box
BOX HEIGHT '11' MM WIDTH '160' MM FRAME 10 TW INTENSITY 35
linessssssss
BOX XPOS '20' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '45' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '80' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '120' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
Boxes, Lines, Shading: BOX, POSITION, SIZE
Use the BOX, POSITION, and SIZE commands for drawing boxes, lines, and shading to print particular windows within a form or passages of text within a window in a frame or with shading.
The SAP printer drivers that are based on page-oriented printers (the HP LaserJet driver HPL2, the Postscript driver POST, the Kyocera Prescribe driver PRES) employ these commands when printing. Line printers and page-oriented printers not supported in the standard ignore these commands. You can view the resulting printer output in the SAPscript print preview.
Syntax:
/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
/: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
BOX Command
Syntax
/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
Effect: draws a box of the specified size at the specified position.
Parameters: For each of XPOS, YPOS, WIDTH, HEIGHT, and FRAME, you must specify both a measurement and a unit of measurement. Specify the INTENSITY parameter as a percentage between 0 and 100.
XPOS, YPOS
Upper left corner of the box, relative to the values of the POSITION command.
Default: Values specified in the POSITION command.
The following calculation is performed internally to determine the absolute output position of a box on the page:
X(abs) = XORIGIN + XPOS
Y(abs) = YORIGIN + YPOS
WIDTH
Width of the box. Default: WIDTH value of the SIZE command.
HEIGHT
Height of the box. Default: HEIGHT value of the SIZE command.
FRAME
Thickness of frame.
Default: 0 (no frame).
INTENSITY
Grayscale of box contents as %.
Default: 100 (full black)
Measurements: You must specify decimal numbers as literal values (like ABAP numeric constants) by enclosing them in inverted commas. Use the period as the decimal point character. See also the examples listed below.
Units of measurement: The following units of measurement may be used:
TW (twip)
PT (point)
IN (inch)
MM (millimeter)
CM (centimeter)
LN (line)
CH (character).
The following conversion factors apply:
1 TW = 1/20 PT
1 PT = 1/72 IN
1 IN = 2.54 CM
1 CM = 10 MM
1 CH = height of a character relative to the CPI specification in the form header
1 LN = height of a line relative to the LPI specification in the form header
/: BOX FRAME 10 TW
Draws a frame around the current window with a frame thickness of 10 TW (= 0.5 PT).
/: BOX INTENSITY 10
Fills the window background with shading having a gray scale of 10 %.
/: BOX HEIGHT 0 TW FRAME 10 TW
Draws a horizontal line across the complete top edge of the window.
/: BOX WIDTH 0 TW FRAME 10 TW
Draws a vertical line along the complete height of the left hand edge of the window.
/: BOX WIDTH '17.5' CM HEIGHT 1 CM FRAME 10 TW INTENSITY 15
/: BOX WIDTH '17.5' CM HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '10.0' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '13.5' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
Draws two rectangles and two lines to construct a table of three columns with a highlighted heading section.
POSITION Command
Syntax
/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
Effect: Sets the origin for the coordinate system used by the XPOS and YPOS parameters of the BOX command. When a window is first started, the POSITION value is set to refer to the upper left corner of the window (default setting).
Parameters: If a parameter value does not have a leading sign, then its value is interpreted as an absolute value, in other words, as a value that specifies an offset from the upper left corner of the output page. If a parameter value is specified with a leading sign, then the new value of the parameter is calculated relative to the old value. If one of the parameter specifications is missing, then no change is made to this parameter.
XORIGIN, YORIGIN
Origin of the coordinate system.
WINDOW
Sets the values for the left and upper edges to match those of the current window (default setting).
PAGE
Sets the values for the left and upper edges to match those of the current output page (XORIGIN = 0 cm, YORIGIN = 0 cm).
/: POSITION WINDOW
Sets the origin for the coordinate system to the upper left corner of the window.
/: POSITION XORIGIN 2 CM YORIGIN '2.5 CM'
Sets the origin for the coordinate system to a point 2 cm from the left edge and 2.5 cm from the upper edge of the output page.
/: POSITION XORIGIN '-1.5' CM YORIGIN -1 CM
Shifts the origin for the coordinates 1.5 cm to the left and 1 cm up.
SIZE Command
Syntax
/: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
Effect: Sets the values of the WIDTH and HEIGHT parameters used in the BOX command. When a window is first started, the SIZE value is set to the same values as the window itself (default setting).
Parameters: If one of the parameter specifications is missing, then no change is made to the current value of this parameter. If a parameter value does not have a leading sign, then its value is interpreted as an absolute value. If a parameter value is specified with a leading sign, then the new value of the parameter is calculated relative to the old value.
WIDTH, HEIGHT
Dimensions of the rectangle or line.
WINDOW
Sets the values for the width and height to the values of the current window (default setting).
PAGE
Sets the values for the width and height to the values of the current output page.
/: SIZE WINDOW
Sets WIDTH and HEIGHT to the current window dimensions.
/: SIZE WIDTH '3.5' CM HEIGHT '7.6' CM
Sets WIDTH to 3.5 cm and HEIGHT to 7.6 cm.
/: POSITION WINDOW
/: POSITION XORIGIN -20 TW YORIGIN -20 TW
/: SIZE WIDTH +40 TW HEIGHT +40 TW
/: BOX FRAME 10 TW
A frame is added to the current window. The edges of the frame extend beyond the edges of the window itself, so as to avoid obscuring the leading and trailing text characters.
http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
<b>Reward points for useful Answers</b>
Regards
Anji
Similar Messages
-
Resizing a cluster (height and width) programatically
Thank you to anyone who can answer this question. Is it possible to resize a cluster on the front panel programatically? If this is possible, how may I do so? I wish to affect the cluster's height and width (or equivalent)? As far as I can tell, the height and width are read only.
Thank you again.
NathanThough you cannot change a Cluster's shell size directly, you can change the size of any item in the shell, which will then change the Cluster's shell size.
So, create a property node to one of your Cluster's controls or indicators and set it to write the 'Size' properties. You can then make this your programic method to resize your cluster's shell. If you don't want to affect any of your cluster's items, then create a 'dummy' transparent control and change it.
See attached LV 6 example.
Good luck with it, Doug
Attachments:
ResizeCluster.vi 17 KB -
Popup window height and width is not as expected
Hi I am using this peace of code to create a popup. But this popup is not created with
the specified height and width. It is created with a default size. Please tell me how to
rectify the problem?
data:
l_api_main type ref to if_wd_view_controller,
l_cmp_api type ref to if_wd_component,
l_window_manager type ref to if_wd_window_manager,
l_popup type ref to if_wd_window.
l_api_main = wd_this->wd_get_api( ).
l_cmp_api = wd_comp_controller->wd_get_api( ).
data: l_i_question type STRING_TABLE,
l_wa_question type string.
l_wa_question = 'Issue no. xxxxxxxxxxx created succcessfully. '.
append l_wa_question to l_i_question.
l_window_manager = l_cmp_api->get_window_manager( ).
l_popup = l_window_manager->create_popup_to_confirm(
text = l_i_question
button_kind = '1'
message_type = '1'
close_button =
window_title = 'Information'
window_width = '500'
window_height = '500'
l_popup->open( ).Hi Mainak,
have a look to Thread:
Popup Sizing
As you can see there is not yet a way to set the Popup size.
You have to find the good combination of fields and length in order to get a nice UI.
The WDA engine try to set the best size, help it...
Sergio -
Fit the image to window width, window height and the window size
hi all
here we wrote the code for "fit the image to window width, window height and the window size". we are facing some problems in it. and all these operations have to perform even after zooming operations are done.if the below code doesnt satisfy kindly provide appropriate code .
thanks .
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.io.File;
import javax.swing.filechooser.FileFilter;
import java.awt.geom.*;
public class DP extends JFrame implements ActionListener,
MouseListener,
MouseMotionListener {
private final int PEN_OP = 1;
private final int CLEAR_OP = 2;
private int radius;
private int radius1;
private int mousex = 0;
private int mousey = 0;
private int prevx = 0;
private int prevy = 0;
private boolean initialFreeHand = true;
private boolean initialLine = true;
private boolean initialEraser = true;
private int Orx = 0;
private int Ory = 0;
private int OrWidth = 0;
private int OrHeight = 0;
private int drawX = 0;
private int drawY = 0;
private int polyX = 0;
private int polyY = 0;
private int eraserLength = 5;
private int udefRedValue = 255;
private int udefGreenValue = 255;
private int udefBlueValue = 255;
private int opStatus = PEN_OP;
private int colorStatus = 1;
private double zoomPercentage=10;
private Color mainColor = new Color(0, 0, 0);
private Color xorColor = new Color(255, 255, 255);
private Color userDefinedColor =
new Color(udefRedValue, udefGreenValue,udefBlueValue);
private JButton openButton = new JButton("open");
private JButton closeButton = new JButton("close");
private JButton zoominButton = new JButton("ZoomIn");
private JButton zoomoutButton = new JButton("ZoomOut");
private JButton zoomto100Button = new JButton("ZoomTo100");
private JButton fwwButton = new JButton("Fit window width");
private JButton fwhButton = new JButton("Fit window height");
private JButton fwButton = new JButton("Fit the window");
private JButton clearButton = new JButton("Clear");
private JTextField colorStatusBar = new JTextField(20);
private JTextField opStatusBar = new JTextField(20);
private JTextField mouseStatusBar = new JTextField(10);
private JPanel controlPanel = new JPanel(new GridLayout(18, 1, 0, 0));
JToolBar jToolbar = new JToolBar();
private Container container;
private JScrollBar horizantalSlide=new JScrollBar();
public BufferedImage image;
BufferedImage bgImage;
// public ImageIcon icon=null;
JFileChooser fileChooser;
DrawPanel drawPanel = new DrawPanel(bgImage,zoomPercentage);
public DP() {
super("WhiteBoard");
fileChooser = new JFileChooser(".");
container = getContentPane();
container.setBackground(Color.white);
container.setLayout(new BorderLayout());
container.add(jToolbar,BorderLayout.NORTH);
container.add(horizantalSlide);
jToolbar.add(openButton);
jToolbar.add(closeButton);
jToolbar.add(zoominButton);
jToolbar.add(zoomoutButton);
jToolbar.add(zoomto100Button);
jToolbar.add(fwwButton);
jToolbar.add(fwhButton);
jToolbar.add(fwButton);
jToolbar.add(clearButton);
colorStatusBar.setEditable(false);
opStatusBar.setEditable(false);
mouseStatusBar.setEditable(false);
controlPanel.setBackground(Color.white);
drawPanel.setBackground(Color.white);
container.add(controlPanel, "West");
container.add(drawPanel, "Center");
openButton.addActionListener(this);
closeButton.addActionListener(this);
zoominButton.addActionListener(this);
zoomoutButton.addActionListener(this);
zoomto100Button.addActionListener(this);
fwwButton.addActionListener(this);
fwhButton.addActionListener(this);
fwButton.addActionListener(this);
clearButton.addActionListener(this);
drawPanel.addMouseMotionListener(this);
drawPanel.addMouseListener(this);
addMouseListener(this);
addMouseMotionListener(this);
opStatusBar.setText("FreeHand");
colorStatusBar.setText("Black");
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("open"))
showDialog();
if(e.getActionCommand().equals("close"))
closeDialog();
if(e.getActionCommand().equals("ZoomIn"))
drawPanel.zoom(1);
if(e.getActionCommand().equals("ZoomOut"))
drawPanel.zoom(-1);
if(e.getActionCommand().equals("ZoomTo100"))
drawPanel.zoom(+10);
if(e.getActionCommand().equals("Fit window width"))
drawPanel.fitwindowwidth();
if(e.getActionCommand().equals("Fit window height"))
drawPanel.fitwindowheight();
if(e.getActionCommand().equals("Fit the window"))
drawPanel.fitthewindow();
if (e.getActionCommand() == "Clear")
opStatus = CLEAR_OP;
switch (opStatus) {
case CLEAR_OP:
clearPanel();
private void showDialog() {
if(fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
try {
bgImage = ImageIO.read(file);
} catch(IOException e) {
System.out.println("IO error: " + e.getMessage());
clearPanel();
private void closeDialog() {
drawPanel.setVisible(false);
drawPanel.repaint();
public void clearPanel() {
opStatusBar.setText("Clear");
Graphics g = image.getGraphics();
g.setColor(drawPanel.getBackground());
g.fillRect(0, 0, drawPanel.getBounds().width, drawPanel.getBounds().height);
if(bgImage != null)
g.drawImage(bgImage, 0, 0, this);
g.dispose();
drawPanel.repaint();
public boolean mouseHasMoved(MouseEvent e) {
return (mousex != e.getX() || mousey != e.getY());
public void setActualBoundry() {
if (mousex < Orx || mousey < Ory) {
if (mousex < Orx) {
OrWidth = Orx - mousex;
drawX = Orx - OrWidth;
} else {
drawX = Orx;
OrWidth = mousex - Orx;
if (mousey < Ory) {
OrHeight = Ory - mousey;
drawY = Ory - OrHeight;
} else {
drawY = Ory;
OrHeight = mousey - Ory;
} else {
drawX = Orx;
drawY = Ory;
OrWidth = mousex - Orx;
OrHeight = mousey - Ory;
public void setGraphicalDefaults(MouseEvent e) {
mousex = e.getX();
mousey = e.getY();
prevx = e.getX();
prevy = e.getY();
Orx = e.getX();
Ory = e.getY();
drawX = e.getX();
drawY = e.getY();
OrWidth = 0;
OrHeight = 0;
public void mouseDragged(MouseEvent e) {
updateMouseCoordinates(e);
switch (opStatus) {}
public void mouseReleased(MouseEvent e) {
updateMouseCoordinates(e);
switch (opStatus) {}
public void mouseEntered(MouseEvent e) {
updateMouseCoordinates(e);
public void updateMouseCoordinates(MouseEvent e) {
String xCoor = "";
String yCoor = "";
if (e.getX() < 0)
xCoor = "0";
else {
xCoor = String.valueOf(e.getX());
if (e.getY() < 0)
xCoor = "0";
else {
yCoor = String.valueOf(e.getY());
mouseStatusBar.setText("x:" + xCoor + " y:" + yCoor);
public void mouseClicked(MouseEvent e) { updateMouseCoordinates(e); }
public void mouseExited(MouseEvent e) { updateMouseCoordinates(e); }
public void mouseMoved(MouseEvent e) { updateMouseCoordinates(e); }
public void mousePressed(MouseEvent e) { updateMouseCoordinates(e); }
public static void main(String[] args) {
DP wb = new DP();
wb.setDefaultCloseOperation(EXIT_ON_CLOSE);
wb.setSize(1024,740);
wb.setVisible(true);
private class DrawPanel extends JPanel {
private double m_zoom = 1.0;
private double m_zoomPercentage;
private BufferedImage m_image;
double theta = 0;
double thetaInc = Math.PI/2;
public DrawPanel(BufferedImage imageb,double zoomPercentage) {
m_image = imageb;
m_zoomPercentage = zoomPercentage / 100;
protected void paintComponent(Graphics g) {
Graphics2D g2d=(Graphics2D)g;
if(image == null)
initImage();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
double x = (1.0 - m_zoom)*getWidth()/2.0;
double y = (1.0 - m_zoom)*getHeight()/2.0;
AffineTransform at = AffineTransform.getTranslateInstance(x, y);
at.rotate(theta,m_zoom*getWidth()/2,m_zoom*getHeight()/2);
at.scale(m_zoom, m_zoom);
g2d.drawRenderedImage(image, at);
public void zoom(int inc) {
m_zoom += inc * m_zoomPercentage;
repaint();
public void fitwindowwidth()
int w1=drawPanel.getWidth();
int h1=drawPanel.getHeight();
BufferedImage image2=image.getScaledInstance(w1,h1,Image.SCALE_DEFAULT);
drawPanel.setPreferredSize(new java.awt.Dimension(100,image2.getImage().getHeight(null)));
drawPanel.repaint();
public void fitwindowheight()
BufferedImage image2=image.getScaledInstance(500,680,1);
drawPanel.setImage(iicon);
drawPanel.setPreferredSize(new java.awt.Dimension(100,image2.getImage().getHeight(null)));
drawPanel.repaint();
public void fitthewindow()
BufferedImage image2=image.getScaledInstance(1000,680,1);
drawPanel.setPreferredSize(new java.awt.Dimension(100,image2.getImage().getHeight(null)));
drawPanel.repaint();
private void initImage() {
int w = getWidth();
int h = getHeight();
image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
g2.setPaint(getBackground());
g2.fillRect(0,0,w,h);
g2.dispose();
}thank you for giving reply.
your code is very helpful to us.but i couldn't integrate it in my code.here's my code.
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.io.File;
import javax.swing.filechooser.FileFilter;
import java.awt.geom.*;
public class IS extends JFrame implements ActionListener,
MouseListener,
MouseMotionListener {
private final int PEN_OP = 1;
private final int CLEAR_OP = 2;
private final int DISTORT = 3;
private final int SCALE = 4;
private final int FIT = 5;
private final int FILL = 6;
int scaleMode = SCALE;
private int radius;
private int radius1;
private int mousex = 0;
private int mousey = 0;
private int prevx = 0;
private int prevy = 0;
private boolean initialFreeHand = true;
private boolean initialLine = true;
private boolean initialEraser = true;
private int Orx = 0;
private int Ory = 0;
private int OrWidth = 0;
private int OrHeight = 0;
private int drawX = 0;
private int drawY = 0;
private int polyX = 0;
private int polyY = 0;
private int eraserLength = 5;
private int udefRedValue = 255;
private int udefGreenValue = 255;
private int udefBlueValue = 255;
private int opStatus = PEN_OP;
private int colorStatus = 1;
private double zoomPercentage=10;
private Color mainColor = new Color(0, 0, 0);
private Color xorColor = new Color(255, 255, 255);
private Color userDefinedColor =
new Color(udefRedValue, udefGreenValue,udefBlueValue);
private JButton openButton = new JButton("open");
private JButton closeButton = new JButton("close");
private JButton zoominButton = new JButton("ZoomIn");
private JButton zoomoutButton = new JButton("ZoomOut");
private JButton zoomto100Button = new JButton("ZoomTo100");
private JButton fwwButton = new JButton("Fit window width");
private JButton fwhButton = new JButton("Fit window height");
private JButton fwButton = new JButton("Fit the window");
private JButton clearButton = new JButton("Clear");
private JTextField colorStatusBar = new JTextField(20);
private JTextField opStatusBar = new JTextField(20);
private JTextField mouseStatusBar = new JTextField(10);
private JPanel controlPanel = new JPanel(new GridLayout(18, 1, 0, 0));
JToolBar jToolbar = new JToolBar();
private Container container;
private JScrollBar horizantalSlide=new JScrollBar();
public BufferedImage image;
BufferedImage bgImage;
// public ImageIcon icon=null;
JFileChooser fileChooser;
DrawPanel drawPanel = new DrawPanel(bgImage,zoomPercentage);
public IS() {
super("WhiteBoard");
fileChooser = new JFileChooser(".");
container = getContentPane();
container.setBackground(Color.white);
container.setLayout(new BorderLayout());
container.add(jToolbar,BorderLayout.NORTH);
container.add(horizantalSlide);
jToolbar.add(openButton);
jToolbar.add(closeButton);
jToolbar.add(zoominButton);
jToolbar.add(zoomoutButton);
jToolbar.add(zoomto100Button);
jToolbar.add(fwwButton);
jToolbar.add(fwhButton);
jToolbar.add(fwButton);
jToolbar.add(clearButton);
colorStatusBar.setEditable(false);
opStatusBar.setEditable(false);
mouseStatusBar.setEditable(false);
controlPanel.setBackground(Color.white);
drawPanel.setBackground(Color.white);
container.add(controlPanel, "West");
container.add(drawPanel, "Center");
openButton.addActionListener(this);
closeButton.addActionListener(this);
zoominButton.addActionListener(this);
zoomoutButton.addActionListener(this);
zoomto100Button.addActionListener(this);
fwwButton.addActionListener(this);
fwhButton.addActionListener(this);
fwButton.addActionListener(this);
clearButton.addActionListener(this);
drawPanel.addMouseMotionListener(this);
drawPanel.addMouseListener(this);
addMouseListener(this);
addMouseMotionListener(this);
opStatusBar.setText("FreeHand");
colorStatusBar.setText("Black");
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("open"))
showDialog();
if(e.getActionCommand().equals("close"))
closeDialog();
if(e.getActionCommand().equals("ZoomIn"))
drawPanel.zoom(1);
if(e.getActionCommand().equals("ZoomOut"))
drawPanel.zoom(-1);
if(e.getActionCommand().equals("ZoomTo100"))
drawPanel.zoom(+10);
if(e.getActionCommand().equals("Fit window width"))
//drawPanel.fitwindowwidth();
drawPanel.scaleImage(0,0,0,0);
if(e.getActionCommand().equals("Fit window height"))
drawPanel.scaleImage(0,0,0,0);
if(e.getActionCommand().equals("Fit the window"))
drawPanel.scaleImage(0,0,0,0);
if (e.getActionCommand() == "Clear")
opStatus = CLEAR_OP;
switch (opStatus) {
case CLEAR_OP:
clearPanel();
private void showDialog() {
if(fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
try {
bgImage = ImageIO.read(file);
} catch(IOException e) {
System.out.println("IO error: " + e.getMessage());
clearPanel();
private void closeDialog() {
drawPanel.setVisible(false);
drawPanel.repaint();
public void clearPanel() {
opStatusBar.setText("Clear");
int w = image.getWidth();
int h = image.getHeight();
Graphics g = image.getGraphics();
g.setColor(drawPanel.getBackground());
g.fillRect(0, 0, w, h);
if(bgImage != null) {
int x = (w - bgImage.getWidth())/2;
int y = (h - bgImage.getHeight())/2;
g.drawImage(bgImage, x, y, this);
g.dispose();
drawPanel.repaint();
public boolean mouseHasMoved(MouseEvent e) {
return (mousex != e.getX() || mousey != e.getY());
public void setActualBoundry() {
if (mousex < Orx || mousey < Ory) {
if (mousex < Orx) {
OrWidth = Orx - mousex;
drawX = Orx - OrWidth;
} else {
drawX = Orx;
OrWidth = mousex - Orx;
if (mousey < Ory) {
OrHeight = Ory - mousey;
drawY = Ory - OrHeight;
} else {
drawY = Ory;
OrHeight = mousey - Ory;
} else {
drawX = Orx;
drawY = Ory;
OrWidth = mousex - Orx;
OrHeight = mousey - Ory;
public void setGraphicalDefaults(MouseEvent e) {
mousex = e.getX();
mousey = e.getY();
prevx = e.getX();
prevy = e.getY();
Orx = e.getX();
Ory = e.getY();
drawX = e.getX();
drawY = e.getY();
OrWidth = 0;
OrHeight = 0;
public void mouseDragged(MouseEvent e) {
updateMouseCoordinates(e);
switch (opStatus) {
public void mouseReleased(MouseEvent e) {
updateMouseCoordinates(e);
switch (opStatus) {}
public void mouseEntered(MouseEvent e) {
updateMouseCoordinates(e);
public void updateMouseCoordinates(MouseEvent e) {
String xCoor = "";
String yCoor = "";
if (e.getX() < 0)
xCoor = "0";
else {
xCoor = String.valueOf(e.getX());
if (e.getY() < 0)
xCoor = "0";
else {
yCoor = String.valueOf(e.getY());
mouseStatusBar.setText("x:" + xCoor + " y:" + yCoor);
public void mouseClicked(MouseEvent e) { updateMouseCoordinates(e); }
public void mouseExited(MouseEvent e) { updateMouseCoordinates(e); }
public void mouseMoved(MouseEvent e) { updateMouseCoordinates(e); }
public void mousePressed(MouseEvent e) { updateMouseCoordinates(e); }
public static void main(String[] args) {
IS wb = new IS();
wb.setDefaultCloseOperation(EXIT_ON_CLOSE);
wb.setSize(1024,740);
wb.setVisible(true);
private class DrawPanel extends JPanel {
private double m_zoom = 1.0;
private double m_zoomPercentage;
private BufferedImage m_image;
double theta = 0;
double thetaInc = Math.PI/2;
public DrawPanel(BufferedImage imageb,double zoomPercentage) {
m_image = imageb;
m_zoomPercentage = zoomPercentage / 100;
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d=(Graphics2D)g;
if(image == null)
initImage();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
int w = getWidth();
int h = getHeight();
int iw = image.getWidth();
int ih = image.getHeight();
if(scaleMode == SCALE) {
double x = (w - m_zoom*iw)/2;
double y = (h - m_zoom*ih)/2;
AffineTransform at = AffineTransform.getTranslateInstance(x, y);
at.rotate(theta,m_zoom*getWidth()/2,m_zoom*getHeight()/2);
at.scale(m_zoom, m_zoom);
g2d.drawRenderedImage(image, at);
else {
scaleImage(w, h, iw, ih);
private void scaleImage( int w, int h, int iw, int ih) {
Graphics2D g2d = image.createGraphics();
double xScale = (double)w/iw;
double yScale = (double)h/ih;
AffineTransform at = new AffineTransform();
if(scaleMode == DISTORT) {
double x = (w - xScale*iw)/2;
double y = (h - yScale*ih)/2;
at.setToTranslation(x, y);
at.scale(xScale, yScale);
} else {
double scale = (scaleMode == FIT) ? Math.min(xScale, yScale)
: Math.max(xScale, yScale);
double x = (w - scale*iw)/2;
double y = (h - scale*ih)/2;
at.setToTranslation(x, y);
at.scale(scale, scale);
g2d.drawRenderedImage(image, at);
public void zoom(int inc) {
m_zoom += inc * m_zoomPercentage;
repaint();
private void initImage() {
int w = getWidth();
int h = getHeight();
image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
g2.setPaint(getBackground());
g2.fillRect(0,0,w,h);
g2.dispose();
} -
Set the height and width of a new browser window
I am trying to open a new browser window when the user clicks
on an audio. The audio will be played in the new browser window.
The only problem I have is that I cannot set the height and width
of the new browser window. I need the window to be much smaller.
How can I do this in flash?You need to ask on a JavaScript forum. Java != JavaScript
-
Chaging Height and Width of POP UP in Webdynpro
Hi,
I want to change the height and width of pop up in webdynpro.
Pop up is designed of view which is embeded in window.
then i am calling
lo_window = lo_window_manager->create_window(
window_name = 'UPLOAD_FILE'
title = 'Upload target file'
close_in_any_case = abap_true
message_display_mode = if_wd_window=>co_msg_display_mode_selected
close_button = abap_true
button_kind = if_wd_window=>co_button_none
message_type = if_wd_window=>co_msg_type_none
default_button = if_wd_window=>co_button_none
is_resizable = abap_true
I have also tried
lo_window->set_window_size( width = '999px' height = '999px' ).
But it is also not working..
How i will resize the pop up.
I have also change the view height and weight but the height is adjusted to some standard level.
Looking for your feedback.
Thanks
Ankesh
Moderator message: please have a look and ask again if necessary in the dedicated "Web Dynpro ABAP" forum.
Edited by: Thomas Zloch on Feb 14, 2011 11:35 AMHi Vedant,
check the below given thread
Is there anyway to make a popup window MODAL in APEX using JavaScript
Hope this will helps you,
Regards,
Jitendra -
Hi Guys,
Is there an easy way to adjust the format of a section?
If i have two parallel sections on a page and each section store 3 small reports, each report takes as default its own size, making the page look really messy.
Is there a way to adapt the first section to look in size as the second section? I tried trough the additional formatting options in section properties and assigned same Height and Weight to the different sections, but the sections still keep its format.
Any idea?
Thanks and Regards
giulianoHi,
First you must have in mind,that you can arrange reports which are similars(almost same rows - columns)
Otherwise you must manualy change the font of characters,to increase or decrease the width - height.
You must always try to configure the reports (for any change) and then the dashboard,,,
Try an alternative one.
You said you have 3 reports, why not put these 3 reports in one and try to arrange them there.???
as a default compound view???
i hope i helped
http://greekoraclebi.blogspot.com/
/////////////////////////////////////// -
Info panel/height and width
When resizing or dragging a guide out the info panel or the height and width box dimensions ar enot live. They do not change until I let go so it is either guess or manually type in. is there a preference setting for this? If not what is the fix. Thanks!
Well I am going to answer my own question if that is allowed. I know there are ratings and such for right answers but I figured out what was wrong/sort of. I closed out and rebooted then brought the program back up and ticked info in the window menu area and voila it is working. So a reboot has done the trick I think.
-
API for Iview to change its propeerties height and width
Hi ,
i need the API for Iview to change its proiperties like height and width and to assign iview to role,
Regards ,
venkat pHi,
Check this to set height & Width to Iview:
Setting iView Parameters
To assign iview to role:
Adding a Role To another Roles by program
http://help.sap.com/saphelp_nw2004s/helpdata/en/5f/cf9d4207e1c86ae10000000a155106/frameset.htm
Regards,
Praveen Gudapati -
What is the swaps height and width shortcut key?
Can please someone tell me, what is the shortcut key of swaps height and width(crop tool)
in adobe photoshop cs4.
Thanx in advance
Regards:
Shami Photos
www.shamiphotos.comYeps, I know it already.
But i need shortcut key. in speedy work I feel disturbance to go upward.
Can we assign it manually?
Regards:
Farrukh Shami
Online Printing -
In Photoshop CC, on a mac...
When using the marquee selection tool, a little black box pops up next to the curser and displays in real time, the height and width of the selection. The same annoying box also appears when dragging an item with the move tool, displaying the numerical location of the cursor. Is there anyway to turn off the display of that little black box? It is driving me bonkers.Under the preferences cmd/ctrl-k click on "Interface". At the bottom of the UI is a drop down box for show transformation. Set that to "Never"
-
How to change the height and width of a control?
Dear all,
is there anyway to change the height and width of a control?
In the property nodes, i am just able to read the bound values but cudnt write to it.
How can i set the bound values for a control?
Thanks,
RiteshNot all controls can be sized this way. For example to change the vertical size of a simple numeric, you would need to change the font size.
LabVIEW Champion . Do more with less code and in less time . -
How to determine height and width of a JScrollPane client
Hi,
I wish to display a webpage in a JScrollPane and wish to determine the height and width of the HTML content so that I can use the information to generate PDF and control the content on each page. Can anybody let me know how I can do this?
Thanks in advance
Prashant BajJEditorPane and getSize()?
-
I am trying to create a instant quote tool for my site.. so customer type in there height and width and a price appears but I have no clue where to start.. is there any tutorial or would someone kindly give me some advice on how to do this on dreamweaver. I havent used Dreamweaver in years and I cant even remember anything now
Kind RegardsWell this is what I have soo far.. so I want to enter the height /width then if they want to add extras such as fixing options and cut out it will add to the product price ????
<!doctype html>
<html>
<head>
<div class="summary entry-summary">
<h1 itemprop="name" class="product_title entry-title">Ral 1000</h1><div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="price" content="160" />
<meta itemprop="priceCurrency" content="GBP" />
<link itemprop="availability" href="http://schema.org/InStock" />
</div><div itemprop="description">
<script src="https://apis.google.com/js/plusone.js" type="text/javascript">
</script>
<script type="text/javascript">gapi.plusone.go();</script>
<p>6mm, low iron, toughened glass, PAR
</div>
<div class="shortcode-google-plusone"><div class="g-plusone" data-size="standard" data-annotation="none"></div></div><!--/.shortcode-google-plusone-->
</p>
</div>
<form class="cart" method="post" enctype='multipart/form-data'>
<table id="price_calculator" class="simple_price_calculator">
<tr>
<td style="text-align:right;">
</td>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script>
$(document).ready(function() {
$('#width').keyup(function() {
var height = $('#height').val();
var width = $('#width').val();
var price = (height * width / 1000000 * 325).toFixed(2);;
$('.price').html('Product price: £' + price);
</script>
</head>
<body>
<p><label for="height">Height (mm)</label>
<input type="text" name="height" id="height">
</p>
<p>
<label for="width">Width (mm)</label>
<input type="text" name="width" id="width">
</p>
<p>
</p>
</body>
</html>
</tr>
</table>
<div class=" product-addon product-addon-add-fixing-option">
<h3 class="addon-name">Add Fixing Option </h3>
<p class="form-row form-row-wide addon-wrap-1738-add-fixing-option">
<select class="addon addon-select" name="addon-1738-add-fixing-option">
<option value="">Select an option...</option>
<option data-price="5" value="silicone-adhesive-tube" >Silicone Adhesive Tube (<span class="amount">£0.00</span>)</option>
<option data-price="5" value="screws-and-drill-holes" >Screws and Drill Holes (<span class="amount">£6.00</span>)</option>
</select>
</p>
<div class="clear"></div>
</div><div class=" product-addon product-addon-add-extra-layer-multi-coloured-fine-glitter">
<h3 class="addon-name">Add Cut Out and Notches </h3>
<p class="form-row form-row-wide addon-wrap-1738-add-extra-layer-multi-coloured-fine-glitter">
<select class="addon addon-select" name="addon-1738-add-extra-layer-multi-coloured-fine-glitter">
<option value="">Select an option...</option>
<option data-price="8" value="1" >1 (<span class="amount">£25.00</span>)</option>
<option data-price="15" value="2" >2 (<span class="amount">£50.00</span>)</option>
<option data-price="25" value="3" >3 (<span class="amount">£75.00</span>)</option>
<option data-price="25" value="4" > (<span class="amount">£100.00</span>)</option>
</select>
</p>
</p><p class="price">Product Price: £</p>
<div class="clear"></div>
</div><div id="product-addons-total" data-type="simple" data-price="160"></div>
<input type="hidden" name="add-to-cart" value="1738" />
<button type="submit" class="single_add_to_cart_button button alt">Add to cart</button>
</form>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
</body>
</html> -
Dynamically size movieclip to fit text's string height and width
Hello,
I am trying to dynamically size a movieclip to fit the size of a text's string height and width (This text is inside the movieclip)
here is my code so far..
var Font1_ = new Font1();
var Format2:TextFormat = new TextFormat();
Format2.size = 36;
Format2.align = TextFormatAlign.CENTER;
Format2.font = Font1_.fontName;
var MessageBox:MovieClip = new MessageBoxMC();
MessageBox.Text1.defaultTextFormat = Format2;
MessageBox.Text1.embedFonts = true;
MessageBox.Text1.antiAliasType = AntiAliasType.ADVANCED;
MessageBox.Text1.wordWrap = true;
MessageBox.Text1.width = 800;
MessageBox.Text1.height = 400;
MessageBox.Text1.textColor = 0xFFFFFF;
MessageBox.Text1.cacheAsBitmap = true;
MessageBox.Text1.mouseEnabled = false;
MessageBox.Text1.text = String("Use the Arrow Buttons to move");
MessageBox.width = MessageBox.Text1.width;
MessageBox.height = MessageBox.Text1.height;
MessageBox.x = 400;
MessageBox.y = 200;
addChild(MessageBox);
this isn't working for me.. anyone know the best way to do this?
I also want the text to be centered in the movieclip, with a border of around 2-4 pixels
I am also not sure if i should be using text.length? any advice and input is greatly welcomed.
thanks in advance!Essentially, you need to check for a change in .textWidth or .textHeight, which are different from .width and .height.
This code works for me (assumes a background box called bg and a foreground text instance fg inside a moveclip and an X and Y bounds offset variable to say how far away you want the box from the text and a textFrameNudge to provide a tweak value).
// Resize background box
thisBox.bg.x = thisBox.fg.x - boundsOffsetX + textFrameNudge; // I'm using .4 as the tweak value for textFrameNudge
thisBox.bg.y = thisBox.fg.y - boundsOffsetY;
thisBox.bg.width = thisBox.fg.textWidth + boundsOffsetX*2 +textFrameNudge*thisBox.fg.getTextFormat().size;
thisBox.bg.height = thisBox.fg.textHeight + boundsOffsetY*2;
Maybe you are looking for
-
How to find change in customer reconciliation account
Hi Experts We have an issue where total customer balance is not tallying with the balance as per Reconciliation account. We feel this could be because reconciliation account of a customer would have been changed. Can you please let me know a) If ther
-
Error message while opening a project: "an error was encountered while loading the image"
We've run into a new error message here today: an error was encountered while loading the image It appears when we try to load a recorded project. It occurs on both the cp-file and the backup file. It's on a windows 7-machine. Anyone encountered it a
-
MAC DUO won't go past BLUE SCREEN on start-up.
Please help! My mac duo has crashed after a mac software update. Now it won't logon past the blue screen! I've tried everything online like DISK UTILITY on Mac os x disc and SAFE MODE but no joy whatsoever. SAFE MODE won't work now after doing it thr
-
I just got a beautiful leather case for my iPhone with a flip top cover. My concern is that a small magnet is in the case which serves as the fastener. Will the magnet damage the iPhone? Can I use this case with my iPhone or should I return it? Thank
-
Using CS5.5 and Windows platform. Opentype fonts do not have opentype options in the character panel fly-out. What can I do to enable opentype options?