How to throw a resize-event?
Hi,
is it possible to throw a resize-event? And do I have to code it?
Thanks
Not quite sure what you mean by "throw" here, but you can define a ComponentListener and add it to a component. One of the methods is componentResized().
hth
Similar Messages
-
How to throw and handle event defined in component interface
Hi folks,
I have defined a component interface with an event 'open_info'
I have some sub components which are implementing that component interface. I also get the two events generated (the interface check box is not marked)
I use those sub components and try to handle the event. but unfortunately the event is not handled.
I'm not sure if I do everything right. I checked the interface checkbox at the events tab of the controller of the sub component. I then may handle the event in the embedding main component. but it appears to be a different event.
probably I eed to access the interface controller and throw the event there, but I don't know how.
I couldn't fnd documentation or wdr* components which deal with that issue. do you have any suggestions?
regards
stefanHi Stefan,
Do the following in the component being used:
say component name is ZCMP_01
go to COMPONENTCONTROLLER
Create an Event with necessary parameters if needed, say Event name is EVNT_01 and has an importing parameter, say PARAM_01 type char10,
Make sure you have set the interface check box. Now this event is available in the INTERFACECONTROLLER.
Say ZCMP_01 has a view with a button, on click of the button, call a method in the COMPONENTCONTROLLER.
Perform all the required operations, At the required point, fire EVNT_01
wd_this->fire_EVNT_01_evt(
PARAM_01 = 'sample' ).
Now the other component that has to use ZCMP_01, say ZCMP_02
In the component properties od ZCMP_02, add usage for ZCMP_01, say USG_CMP_01
Go to the view in ZCMP_02 where you wish to handle the event EVNT_01 of ZCMP_01,
Go to Methods tab, create an event hadler, say EVNT_01_HNDLR ... method type = Event Handler,
Event = EVNT_01, Controller = INTERFACECONTROLLER, Component Use, USG_CMP_01.
Now your event handler will have foll parametrs: WDEVENT .. type ref to CL_WD_CUSTOM_EVENT,
PARAM_01 type CHAR10
Handle the event as required.
Regards,
Reema. -
How to throw the mouse event to a upper level component?
For example: a panel using absolute layout, and there is a label on it.
Now when mouse clicked on the label, i do not want the label but the panel to get the mouse event , so that i can get the mouse click point's x and y in the panel.
How to implement it?
Thanks a looooooooooooot for ur help
Best Regardstry this
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Testing extends JFrame
public Testing()
setSize(100,75);
setLocation(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
final JPanel p = new JPanel();
JLabel lbl = new JLabel("Click Me");
lbl.setToolTipText("OK");
lbl.setBorder(BorderFactory.createLineBorder(Color.BLACK));
p.add(lbl);
getContentPane().add(p);
lbl.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent me){//match method name
p.dispatchEvent(me);}});
p.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent me){//with this method name
System.out.println("Panel clicked");}});
public static void main(String[] args){new Testing().setVisible(true);}
} -
Intercept the resize event of the header of the column
hi
how to intercept the resize event of the header of the columnAdd a changeListener to the width property:
firstNameCol.widthProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue observable, Object oldvalue, Object newValue) {
System.out.println("The column width is changed: New width is " + newValue);
}); -
How to handle component's resize event
Hi All,
Can someone tell whether you can in any way to capture component's resize event, e.g. panelGroupLayout?
Thanks!Hi,
its an event raised on the render kit, the component will not pass this on to the server.
I did not try JavaScript but there is a registerResizeNotifyComponent(Object component) on the AdfPAGE object that you may be able to register a custom proxy object to. Then when the proxy receives the resize event you would call a custom event to the srever (serverListener)
http://docs.oracle.com/cd/E23549_01/apirefs.1111/e12046/oracle/adf/view/js/base/AdfPage.html
Frank
Ps.: As said - haven't tried this -
Node Container that does not resize with Window Resize Event
Hello,
I'm not new to Java but I am new to JavaFX.
I plan to have a container/Canvas with multiple shapes (Lines, Text, Rectangle etc) in it. This Container can be X times in the Szene with different Text Shapes. I need to Zoom and Pan (maybe rotation) the whole Szene and the Containers/Canvas.
So I was playing around with that but I have two issues.
1) all Canvas classes that I found (like Pane for example) do resize with the main window resize event. The content of the canvas isn't centered any more.
2) I added a couple of Rectangles to the canvas and both the rectangles and the canvas have a mouse listener which will rotate the item/canvas. Problem is, that even if I click the rectangle also the underlaying canvas is rotated...I think I need some kind of Z-Info to find out what was clicked.
Here is the little example program, it makes no produktiv sense but it demonstrates my problem.
Does anybody has a tip what canvas class would fit and does not resize with the main window and how to figure out what was clicked?
public class Test extends Application
Scene mainScene;
Group root;
public static void main(String[] args)
launch(args);
@Override
public void init()
root = new Group();
int x = 0;
int y = -100;
for(int i = 0; i < 5; i++)
x = 0;
y = y + 100;
for (int j = 0; j < 5; j++)
final Rectangle rect = new Rectangle(x, y, 30 , 30);
final RotateTransition rotateTransition = RotateTransitionBuilder.create()
.node(rect)
.duration(Duration.seconds(4))
.fromAngle(0)
.toAngle(720)
.cycleCount(Timeline.INDEFINITE)
.autoReverse(true)
.build();
rect.setOnMouseClicked(new EventHandler<MouseEvent>()
public void handle(MouseEvent me)
if(rotateTransition.getStatus().equals(Animation.Status.RUNNING))
rotateTransition.setToAngle(0);
rotateTransition.stop();
rect.setFill(Color.BLACK);
rect.setScaleX(1.0);
rect.setScaleY(1.0);
else
rect.setFill(Color.AQUAMARINE);
rect.setScaleX(2.0);
rect.setScaleY(2.0);
rotateTransition.play();
root.getChildren().add(rect);
x = x + 100;
public void start(Stage primaryStage)
final Pane pane = new Pane();
pane.setStyle("-fx-background-color: #CCFF99");
pane.setOnScroll(new EventHandler<ScrollEvent>()
@Override
public void handle(ScrollEvent se)
if(se.getDeltaY() > 0)
pane.setScaleX(pane.getScaleX() + 0.01);
pane.setScaleY(pane.getScaleY() + 0.01);
else
pane.setScaleX(pane.getScaleX() - 0.01);
pane.setScaleY(pane.getScaleY() - 0.01);
pane.getChildren().addAll(root);
pane.setOnMouseClicked(new EventHandler<MouseEvent>(){
@Override
public void handle(MouseEvent event)
System.out.println(event.getButton());
if(event.getButton().equals(MouseButton.PRIMARY))
System.out.println("primary button");
final RotateTransition rotateTransition2 = RotateTransitionBuilder.create()
.node(pane)
.duration(Duration.seconds(10))
.fromAngle(0)
.toAngle(360)
.cycleCount(Timeline.INDEFINITE)
.autoReverse(false)
.build();
rotateTransition2.play();
mainScene = new Scene(pane, 400, 400);
primaryStage.setScene(mainScene);
primaryStage.show();
}Edited by: 953596 on 19.08.2012 12:03To answer my own Question, it depends how you add childs.
It seems that the "master Container", the one added to the Scene will allways resize with the window. To avoid that you can add a container to the "master Container" and tell it to be
pane.setPrefSize(<child>.getWidth(), <child>.getHeight());
pane.setMaxSize(<child>.getWidth(), <child>.getHeight());
root.getChildren().add(pane);and it will stay the size even if the window is resized.
Here is the modified code. Zooming and panning is working, zomming to window size is not right now. I'll work on that.
import javafx.animation.Animation;
import javafx.animation.ParallelTransition;
import javafx.animation.ParallelTransitionBuilder;
import javafx.animation.RotateTransition;
import javafx.animation.RotateTransitionBuilder;
import javafx.animation.ScaleTransitionBuilder;
import javafx.animation.Timeline;
import javafx.animation.TranslateTransitionBuilder;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.geometry.Point2D;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.ScrollEvent;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import javafx.util.Duration;
public class Test extends Application
Stage primStage;
Scene mainScene;
Group root;
Pane masterPane;
Point2D dragAnchor;
double initX;
double initY;
public static void main(String[] args)
launch(args);
@Override
public void init()
root = new Group();
final Pane pane = new Pane();
pane.setStyle("-fx-background-color: #CCFF99");
pane.setOnScroll(new EventHandler<ScrollEvent>()
@Override
public void handle(ScrollEvent se)
if(se.getDeltaY() > 0)
pane.setScaleX(pane.getScaleX() + pane.getScaleX()/15);
pane.setScaleY(pane.getScaleY() + pane.getScaleY()/15);
System.out.println(pane.getScaleX() + " " + pane.getScaleY());
else
pane.setScaleX(pane.getScaleX() - pane.getScaleX()/15);
pane.setScaleY(pane.getScaleY() - pane.getScaleY()/15);
System.out.println(pane.getScaleX() + " " + pane.getScaleY());
pane.setOnMousePressed(new EventHandler<MouseEvent>()
public void handle(MouseEvent me)
initX = pane.getTranslateX();
initY = pane.getTranslateY();
dragAnchor = new Point2D(me.getSceneX(), me.getSceneY());
pane.setOnMouseDragged(new EventHandler<MouseEvent>()
public void handle(MouseEvent me) {
double dragX = me.getSceneX() - dragAnchor.getX();
double dragY = me.getSceneY() - dragAnchor.getY();
//calculate new position of the pane
double newXPosition = initX + dragX;
double newYPosition = initY + dragY;
//if new position do not exceeds borders of the rectangle, translate to this position
pane.setTranslateX(newXPosition);
pane.setTranslateY(newYPosition);
int x = 0;
int y = -100;
for(int i = 0; i < 5; i++)
x = 0;
y = y + 100;
for (int j = 0; j < 5; j++)
final Rectangle rect = new Rectangle(x, y, 30 , 30);
final RotateTransition rotateTransition = RotateTransitionBuilder.create()
.node(rect)
.duration(Duration.seconds(4))
.fromAngle(0)
.toAngle(720)
.cycleCount(Timeline.INDEFINITE)
.autoReverse(true)
.build();
rect.setOnMouseClicked(new EventHandler<MouseEvent>()
public void handle(MouseEvent me)
if(rotateTransition.getStatus().equals(Animation.Status.RUNNING))
rotateTransition.setToAngle(0);
rotateTransition.stop();
rect.setFill(Color.BLACK);
rect.setScaleX(1.0);
rect.setScaleY(1.0);
else
rect.setFill(Color.AQUAMARINE);
rect.setScaleX(2.0);
rect.setScaleY(2.0);
rotateTransition.play();
pane.getChildren().add(rect);
x = x + 100;
pane.autosize();
pane.setPrefSize(pane.getWidth(), pane.getHeight());
pane.setMaxSize(pane.getWidth(), pane.getHeight());
root.getChildren().add(pane);
masterPane = new Pane();
masterPane.getChildren().add(root);
masterPane.setStyle("-fx-background-color: #AABBCC");
masterPane.setOnMousePressed(new EventHandler<MouseEvent>()
public void handle(MouseEvent me)
System.out.println(me.getButton());
if((MouseButton.MIDDLE).equals(me.getButton()))
double screenWidth = masterPane.getWidth();
double screenHeight = masterPane.getHeight();
System.out.println("screenWidth " + screenWidth);
System.out.println("screenHeight " + screenHeight);
System.out.println(screenHeight);
double scaleXIs = pane.getScaleX();
double scaleYIs = pane.getScaleY();
double paneWidth = pane.getWidth() * scaleXIs;
double paneHeight = pane.getHeight() * scaleYIs;
double screenCalc = screenWidth > screenHeight ? screenHeight : screenWidth;
double scaleOperator = screenCalc / paneWidth;
double moveToX = (screenWidth/2) - (paneWidth/2);
double moveToY = (screenHeight/2) - (paneHeight/2);
System.out.println("movetoX :" + moveToX);
System.out.println("movetoY :" + moveToY);
//double scaleYTo = screenHeight / paneHeight;
ParallelTransition parallelTransition = ParallelTransitionBuilder.create()
.node(pane)
.children(
TranslateTransitionBuilder.create()
.duration(Duration.seconds(2))
.toX(moveToX)
.toY(moveToY)
.build()
ScaleTransitionBuilder.create()
.duration(Duration.seconds(2))
.toX(scaleOperator)
.toY(scaleOperator)
.build()
.build();
parallelTransition.play();
public void start(Stage primaryStage)
primStage = primaryStage;
mainScene = new Scene(masterPane, 430, 430);
primaryStage.setScene(mainScene);
primaryStage.show();
} -
Resize event triggerd on TransistionManager.start ?!
Hello there i got something in AS3 thats a bid odd or maybe im doing something wrong.
I made a small example te clear some things up (see bottom part):
This example relies on 1 MC on the stage called testMc now when you run this code it works fine.
Evry time you click the movieclip in does what its suppose to do.
The output shows
trans
trans
trans
trans
etc
The problem lies when you resize the screen and then press the button again for a few times you will see this in the output
trans
resize
resize
resize
resize
resize
resize
trans
resize
trans
resize
trans
resize
trans
resize
Somehow after the resize is done it keeps calling out for the resize event.
How is this possible ?! and what can i do to fix this problem Ow i made it in CS5 if thats any help
Thanks in advance
import flash.events.MouseEvent;
import fl.transitions.*;
import fl.transitions.easing.*;
stage.addEventListener(Event.RESIZE, stageResize, false, 0, true);
function stageResize(evt:Event):void
trace('resize');
testMc.addEventListener(MouseEvent.MOUSE_DOWN, testTrans, false, 0 , true);
testMc.buttonMode = true;
function testTrans(evt:MouseEvent):void
trace('trans');
TransitionManager.start(testMc, {type:Fly, direction:Transition.IN, duration:2, easing:Elastic.easeOut, startPoint:4});I don't think very many people use the TransitionManager class or really care about it at all. It is very limited in what it does and isn't very explicable or flexible. That is probably why nobody has responded.
But evidently there is something in the Class that causes a resize event to be fired if the stage has been changed from its original size. BTW, are you testing this just in the IDE test environment? Most likely since it includes trace statements. Have you verified that it still does this on an html page (or whatever your eventually delivery format will be)? I tested it under AS3 in the testing environment and saw what you are seeing. But I haven't tried the other formats.
If you are on a PC you could go into the Class files and add some trace statments in the classes and see where that event might be getting dispatched. The files are at:
C:\Program Files\Adobe\Adobe Flash CS4\Common\Configuration\ActionScript 3.0\projects\Flash\src\fl\transitions
Be sure to make a back up before you go messing with them.
But the best thing to do would be to not use the TransitionManager class! -
if (EventEnum != SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE & EventEnum != SAPbouiCOM.BoEventTypes.et_FORM_LOAD)
SAPbouiCOM.Form oCurrentForm = SBO_Application.Forms.Item(FormUID);
if (EventEnum == BoEventTypes.et_FORM_RESIZE)
try
oCurrentForm.Items.Item("PLB").Left = oCurrentForm.Items.Item("10000330").Left - oCurrentForm.Items.Item("PLB").Width - 3;
oCurrentForm.Items.Item("PSOB").Left = oCurrentForm.Items.Item("PLB").Left - oCurrentForm.Items.Item("PSOB").Width - 3;
oCurrentForm.Items.Item("PLB").Top = oCurrentForm.Items.Item("10000330").Top;
oCurrentForm.Items.Item("PSOB").Top = oCurrentForm.Items.Item("PLB").Top;
catch { }
//TODO: This is triggered many times. WHY ?????
My goal is to keep 2 custom buttons aside system one but
I tried many things in form_Load, Activate or with things like BeforeAction, etc..etc
I dont know how to make sure that the buttons are really positioned correctly and avoid makeing a call to the resize event many times for nothing
In this actual form, the code make the form flickering many times before get finaly stop.
Else then that, the buttons are very nicely placed and when I resize, they stay right at their place.> Marc ...
>
>
> My guess is that you can achive this by specifying
> the controls for which you need the resize. You can
> do something like this ..
>
> if (EventEnum !=
> SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE & EventEnum
> != SAPbouiCOM.BoEventTypes.et_FORM_LOAD)
> {
> SAPbouiCOM.Form oCurrentForm =
> SBO_Application.Forms.Item(FormUID);
> if (EventEnum == BoEventTypes.et_FORM_RESIZE)
> {
> try
> {
> switch (FormUID)
> {
> case "PLB":
> oCurrentForm.Items.Item("PLB").Left =
> t = oCurrentForm.Items.Item("10000330").Left -
> oCurrentForm.Items.Item("PLB").Width - 3;
> oCurrentForm.Items.Item("PLB").Top =
> p = oCurrentForm.Items.Item("10000330").Top;
> break;
> case "PSOB":
> oCurrentForm.Items.Item("PSOB").Left =
> t = oCurrentForm.Items.Item("PLB").Left -
> oCurrentForm.Items.Item("PSOB").Width - 3;
> oCurrentForm.Items.Item("PSOB").Top =
> p = oCurrentForm.Items.Item("PLB").Top;
> break;
> }
> }
> catch { }
> }
> }
>
> The idea is to try to delimit the times the Resize
> event is detected. Also try using the
> <b>oForm.Freeze = true</b> at the beginning and
> <b>oForm.Freeze = false</b> when done setting the
> controls. This should take care of the flickering.
Sorry but it never get into any one of those 2 case.
All I see is "F_12" or "F_13" when I debug at the switch line -
Newbie question - sorry. How do I capture the browser window
resize event?
I've tried variations on this code:-
<mx:Script>
<![CDATA[
import flash.events.Event;
function mylisten():void { trace('mylisten');
this.stage.addEventListener(Event.RESIZE,resizefn);
function resizefn():void {
trace('resize!');
]]>
</mx:Script>Hi brutfood,
you can add a handler to the resize event of the application
as an attribute of the Application tag.
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" resize="resizeHandler()">
Then add the handler ("t" is TextArea):
private function resizeHandler():void {
t.text = stage.width + " - " + stage.height;
t.text += "\n" + stage.stageWidth + " - " +
stage.stageHeight;
Note the difference between the width/height and
stageWidth/stageHeight properties: the first couple returns the
actual stage dimension while the second returns the visible area of
the stage.
regards,
Christophe -
In iCal how do i set an event every 3 months
In iCal how do i set an event every 3 months.
Sk8trdad,
I presume that your question relates to the Calendar App on the iPad.
You have to use the "repeat>Custom" setting on the Desktop version of iCal. -
How can I set an event to repeat on a week day rather than a numerical day of each month?
How can I set an event to repeat on a week day rather than a numerical day of each month? I see an option at the bottom of the repeat window .... but I cannot use it. Actually, when I try it freezes up my Calendar.
Lorrene Baum DavisThese scrrenshots are from Snow Leopard - I would think that Lion wouldn't be too much different.
-
How can i clear all events in ical
how can i clear all events in ical
Try typing "." without the exclamation points in the iCal search window. Then simply highlight all the entries > Edit/Delete
-
How do I create an Event Handler for an Execute SQL Task in SSIS if its result set is empty
So the precedence on my entire package executing is based on my first SELECT of my Table and an updatable column. If that SELECT results in an empty result set, how do I create an Event Handler to handle an empty result set?
A Newbie to SSIS.
I appreciate your review and am hopeful for a reply.
PSULionRPDepends upon what you want to do in the eventhandler. this is what you can do
Store the result set from the Select to a user variable.
Pass this user variable to a Script task.
In the Script task do whatever you want to do including failing the package this can be done by failing the script task, which in turns fails the package. something like
Dts.TaskResult = Dts.Results.Failure
Abhinav http://bishtabhinav.wordpress.com/ -
How can I move an event in my calendar to my "completed" calendar without changing all the events in the series?
As Apple has yet to upgrade iCalendar so I can check off my events as I complete them (no, I do not want to use a task list/reminder list), I want to be able to move my events to my "completed" events calendar as I complete them. The issue is that most of my events are repeating events, and it changes the entire series. How do I change only the event I clicked on using my iPhone?
ThanksIf you change anything in a repeating calendar entry it will give you the option of disconnecting it from the series. So may any random change, choose to not change the series.
-
IMovie 10 - how do I move an event from one library to another?
Greetings,
I have updated all of my projects and events from iMovie 9 to iMovie 10.0.1. They now all sit in different libraries on different external HDDs.
How do I move an event from one library to another library in iMovie 10? How do I copy an event from one library to another library in iMovie 10?
Thanks,
JohnSimply drag and drop from one library to another. See: http://help.apple.com/imovie/mac/10.0/#mov3fa25bae7
Geoff.
Maybe you are looking for
-
Unable to add phone number to my messages.app
Hello Everyone I am unable to add my phone number to messages.app. Everything was working ok till this AM when I started messages.app and noticed my phone number missing. I have tried the following. 1.Restoring olderversion of messages.app from Time
-
BIS activation troublesho​oting and service books
I have a verizon BB8830(unlocked) am on Airtel and BIS worked fine some 6 months back.But now BIS has stopped working when activated,I wiped then device and tried OS update still nothing and it can no longer receive service books fro my carrier inclu
-
Upgrading iPad2 to iOS 5 - Any issues?
Hello - I've been slow to update my iPad2 to iOS 5 since I had some issues with the last iOS update. Anyone experience any major issues that you would like to share?
-
Unwanted Blank pages in smartform
Q=> I have created a smartform where i have given the condition for 3rd and 4th pages when the condition does not satisfies it gives blank pages in preview.
-
Mavericks clean install problems
Created a boot drive just like all the tutorials say. Went through entire install process with no issues. Finally get Mavericks up and running but I see some of my apps on there, like a couple games and some other apps. Also had numerous files from