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
Similar Messages
-
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 -
I'm trying to write lingo, that tells a certian object, upon
the mouse leaving, to scale down by x amount. However I want it to
be animated and happen over time. But I want it to all be in Lingo,
within the cast member. I have it looking like this right now, but
this just makes it go from one size, immediately to a smaller size.
Like I said, I would like this to happen over a period of say, .5
seconds.
on mouseLeave me
sprite(2).height = 438
sprite(2).width = 292
end
I'm doing this for something like a portfolio. You can roll
over images and they get larger, but when you roll off of them,
they get smaller. I just want them to get smaller over time, and
not immediately. Any help would be great. Thanks.
~QuadpolarSince mouseLeave only happens once it can't easily be used to
animate
something... so, you need to set up a system where the
shrinking happens
on an event that happens more often (like enterFrame)
property pShrink
on beginSprite me
pShrink=0 --set it to not shrink when it starts up
end
on mouseLeave me
pShrink=1 --start shrinking now
end
on enterFrame me
if pShrink=1 then
if sprite(2).height>400 then
sprite(2).height=sprite(2).height-2
sprite(2).width=sprite(2).width-2
else
pShrink=0 --now it will stop shrinking
end if
end if
end
This script kind of assumes that the sprite is square, since
it adjusts
the height and width evenly. Change those lines where the
width and
height are lowered by 2 to a greater number to make it go
faster or a
lower number to make it go slower (it has to be an integer,
so 1 is as
slow as it gets). Also, if the height and width are not
equal, then
adjust those same numbers accordingly. I also chose the
number 400
fairly arbitrarily.. that should be whatever height the
sprite should be
when you want it to stop shrinking. -
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
-
Fancybox iframe in Edge Animate - Not showing correct height and width
Hi All,
Can someone please provide advice or a solution to this issue.
I have been trying to use the Fancybox.js in Edge Animate to call an iframe (as a lightbox pop up).
However when I try this it doesn't show the correct height and width properties - even though I am setting them.
When I test this on my hard drive it works fine in Chrome and Firefox. However when tried online on a test server I get a slim pop up that hasn't set the height properly.
Could this be because the iframe is pre-loading the composition/html page first before setting the size??
Please help
CODE USED:
$.fancybox.open(
type: 'iframe',
autoScale : 'false',
height: '600',
widht: '600',
href : 'website composition link.html',
padding : 0
Other references: http://businessanywhere.biz/blog/2013/03/adding-a-lightbox-to-edge-animate/
Cheers,
JasonHI Darmendra,
Thank you for your reply to this.
I worked out what the problem was - my external composition that was created Edge Animate was centred both horizontally and vertically.
This was created the problem. When I took this off the fancy box worked well.
Cheers,
Jason -
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 -
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.
-
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; -
How to resize and maintain height and width ratio IR image column
Hello, I am upgrading from 3.2 to 4.1 reports that include images in report columns. I have had good success with this except for one thing. If the height and width is fixed it distorts the photos, and if I do not have fixed dimensions the image may be too large depending on the original dimensions of the :P1_PHOTO item which is File Browse... BLOB column. I do not want to restrict users ability to upload large image files, or files with different dimensions, but I want them to display as a thumbnail size proportional to the original dimensions in the report, or maybe I need a different approach? Report region template is No Template. I appreciate any suggestions.
select decode(nvl(dbms_lob.getlength(photo),0),0,null,'<img src="'||apex_util.get_blob_file_src('P1_PHOTO',id)||'" height="75" width="75"/>') photo from table.
I tried using percent i.e.: width="10%" that does not work.
I have tried several variations of <style> in page HTML header to change column width, but the image size does not change.
<style>
td[headers="PHOTO"] {
width:75px;
</style>
<style>
#apexir_PHOTO{width: 75px;}
</style>
Thanks.Try to go with max-width / max-height. However, if you have IE browser, hang on for pain. For some ideas, some links:
http://wordpress.mfields.org/2011/scaling-images-in-ie8-with-css-max-width/ (ignore object-fit, it is not yet supported on most browser)
http://stackoverflow.com/questions/3915219/max-width-on-img-tag-not-working-in-ie8
etc. Be sure to try out your chosen solution on the target browser(s)!
IE is just nasty :(
What i have done before is not to have my browser scale my images, especially when the images can be large(r) and you expect quite some traffic. All those extra (kilo)bytes won't help it load faster. I just added an extra column in the table, like photo_thumb, and create a scaled version of the uploaded picture when it is being inserted.
For example, i have the following process on my apex page, and i'm using wwv_flow_files.
Have some code:
IF :P3_FIND_PHOTO IS NOT NULL THEN
DECLARE
v_id number;
v_small_photo blob;
v_large_photo blob;
v_mime_type apxt_contacts_img.mime_type%type;
v_content_type apxt_contacts_img.content_type%type;
BEGIN
SELECT blob_content a, blob_content b, mime_type, content_type
INTO v_small_photo, v_large_photo, v_mime_type, v_content_type
FROM wwv_flow_files
WHERE name = :P3_FIND_PHOTO;
IF lower(v_mime_type) NOT IN ('image/jpg', 'image/jpeg') THEN
raise_application_error(-20001, 'File for upload is not a jpg!');
END IF;
-- Rezise the photo so that it is proportionally 125*125
-- ordimage is an oracle type able to manipulate all sorts of pictures
ordimage.process(v_small_photo, 'maxScale=125 125');
-- If contact is of type personnel, then no need to store
-- a large photo since it wont be displayed
IF :P3_CONTACT_TYPE_ID = 2 THEN
v_large_photo := NULL;
END IF;
-- Delete previously uploaded picture
IF :P3_ID IS NOT NULL THEN
DELETE FROM apxt_contacts_img
WHERE contact_id = :P3_ID;
END IF;
-- Insert the data into the contacts_img table as a
-- SELECT from WWV_FLOW_FILES
INSERT INTO apxt_contacts_img
(contact_id,
image_name,
mime_type,
content_type,
filename,
small_photo,
large_photo)
VALUES
(:P3_ID,
:P3_LASTNAME,
v_mime_type,
v_content_type,
:P3_FIND_PHOTO,
v_small_photo,
v_large_photo);
-- Remove the image from the apex wwv_flows_files table
DELETE FROM wwv_flow_files WHERE name = :P3_FIND_PHOTO;
END;
END IF; -
Dynamically changing the height and width of Stage
Hi,
I would like to know how can I change the height and width of stage dynamically. I tried it with the following code:
Stage.height = 250;
Stage.width = 250;
during the run time. Initially the Stage is at a height and width of 370 and 450 respectively. Also when I tried to trace the height and width of Stage after resizing the stage width and height, its showing the old value of width and height. That means the width and height not chnaging. Anybody have any idea about this.Hi Ross,
I could understand something about the problem after making a research on this topic. We can't change the width and height of stage from actionscript itself, right? I will explain the way I am planning to do. I don't know whether its right or not. Anyway you just go through it. First the player need to be resized, according to the specified height and width. Then in the object tag, there are two fields named height and width. We should change these value according to the specified height and width of video controller, dynamically. Am I right? But I am confused with two properties of Stage such as: align and scaleMode. The code was actually developed my trainer. There, the scaleMode is set to "noScale" and no align property is used. My doubt is how should I set align and scaleMode properties of Stage. Hope you understood what I meant.
Regards,
Sreelash.S. -
Height and width of image loaded into blob?
i am loading images into my database which is all working fine. in parts of my app i am displaying these images so i am wondering is there a way to get the dimensions (height an width) of the image you are loading in so that when it comes time to display you can scale as needed but the aspect ratio is the same so then the image is not distorted by just putting some random values for height and width.
<br><br>
eg
instead of
<br><br>
select decode(file_type,'I','<imge src="OWNER.download_file?p_file=' || nvl(file_id,0) ||'" height="100" width="100" />','') from project_file
where file_id = :P31_FILE_ID
<br><br>
i want to replace 100 with values from columns in table that were loaded at time of save
Message was edited by:
victorpthanks scott. is it correct to say that this example is storing the image at whatever size the user puts in the width and height boxes on screen? thats what it looks like to me anyway. i see there are functions to get these but does the user have to enter them still? it will be just what i need if indeed I do need it!
Yes, that's correct. Of course you could modify the code so that you choose the size of the image, and not allow the user to change it.
Thanks,
- Scott - -
Dynamically read height and width dimensions of .mov
Hi there!
I am wondering if anyone knows of a way to dynamically get the height and width dimensions of a quicktime movie, before streaming it?
The circumstances are this. I have clients who upload quicktime movies to my server. Right now, I use code to embed movies in a fixed size page, but the movies can vary quite dramatically in terms of their dimensions. For example, if the movie is 400px wide, it looks fine in my page. However, if it is 800px wide, it extends out beyond the borders of my page and looks terrible. I could just make a huuge page, but then the tiny movies look ridiculous
If I could somehow gets the dimensions of a movie before it starts streaming, i could create a large target page for larger movies, and a small target page for small movies. Basically it comes down to being able to somehow dynamically read the dimenions of the movie.
Is this even possible? Like my boss keeps telling me, it's all just Math isn't it?
Thanks!!!Hmmm...
I think the movie dimensions are exposed to JavaScript, but only after the movie has opened. So you would have to load the movie into the plugin, then get the dimensions, then use JavaScript to rewrite the page. Which I don't think is quite what you had in mind; you're wanting to collect this information and deal with it before you write the page.
Let me see if I have this straight...You are allowing clients to upload movies to your server, and then you're hoping to generate an embedded movie page on the fly in PHP to display the movie just uploaded, correct?
For a library of movies, you could generate a small database of all the movie dimensions, then just look that data up in the table when you generate the page. The trouble is, I don't know of any way to get the movie dimensions except to get them from QuickTime, and to do that you have to load the movie into either the player or the plugin. You could, for instance, have an AppleScript that looks at each movie and populates the database, but I don't see how you could trigger that to run on upload, and I don't know what kind of server you're using.
Now here's an idea...If you have some way of arbitrarily reading and parsing the QuickTime file, you can get the dimensions out of the file, but it isn't easy. If you are lucky, the moov atom will include a prfl atom (movie profile) which includes the video dimensions. But the prfl atom is not mandatory, which means you have to look at each trak atom that contains video and examine the size *and position* and accommodate the fact that you may have multiple, overlapping video tracks. But you could get the data by parsing the QT atoms yourself. All the data you need to do that is here:
http://developer.apple.com/documentation/QuickTime/QTFF/QTFFPreface/chapter1_section1.html
...and may God have mercy on your soul!
Seriously, though, you CAN parse a QT file, and that might be the best (though obviously not the easiest!) way to get the data you want dynamically. QuickTime does help you out by giving you all the offsets for all the atoms, but it can be tricky!
--Dave Althoff, Jr. -
Hello,
I'm building an one page parallax website, and I would like to make each section (anchor) responsive to the screen size, 100% height and width, it's that possible ? how ?
thanks !
MirkoHi Mirko,
Creating a responsive website using Adobe muse is not possible at the moment. But you can check some suggestion in the following post,Can you create responsive sites with Adobe Muse? -
What's the height and width of canvas3d
what's the height and width of canvas3d
I do not know if this will fully answer you question but:
1) For a successfully executed Canvas3D, there should be a default size based on the system. If c3d is a Canvas3D object, try System.out.println( c3d ); This will given the Canvas3D object's ID, upper left corner location, and size (plus a possible status indicator whose meaning I do not fully understand). Also, the methods getSize(), getHeight(), getWidth() can be used to get the Canvas3D object's size.
2) You can set the size and location of the Canvas3D object (which then can be added to some container of size W x H, e.g., JPanel) via:
Canvas3D c3d;
c3d.setSize(w, h); // where 0< w <= W and 0 < h <=H are preferred
c3d.setLocation(x, y); // where 0 <= x <= W-w and 0 <= y <= H-h are preferred
Note, the size and location can be set anytime after the Canvas3D object is declared/instantiated.
I hope that the above is helpful.
stmoss
Maybe you are looking for
-
How can i get pics from my 6225 to my pc???
photo's NEED to get off my old CDMA nokia 6225 but i have no idea how? is there software and a cable perhaps??? desperately need help with this one...is there any way to infra red to my pc i can bluetooth pics with my new mobile but cant seem to find
-
Pseudo code for DOM parsing a local XMl file
HI all, 1) Can any body please provide me the JAVA pseudo code for parsing xml document from local mcahine and create another xml document in another location in loca machine with small transofrmations ? (JAVA mapping using DOM parsing tehnique u
-
Oracle GL error during journal import- ICM DOWN
Hi all, I hit an error regarding the Concurrent Manager - Oracle GL during the journal import from GL_INTERFACE table. I've already populate the table with a set of dummy values. i've run the journal import to import the value from the table. i've cl
-
Determining best image overlay size to use
Hi folks So I'm working with Premiere Pro CS6 doing some video editing for a minister friend of mine. During bits of the video, I've been overlaying quotes and whatnot. I'd like to achieve some consistency by always ensuring these appear in the same
-
ALV list which is editable ? :-) :-)
Hi Team, Can you please guide me on how to Create an editable ALV list output (step by step,, Please). I am only familiar with normal ALV list. Thanks...Aby Jacob