Tricky Passing Event problem
Hi,
I have two files here. 1) MyFavorites 2)
MyFavoritesItemRenderer
I have a datagrid with an item renderer. The item renderer is
essentially a delete image. I am trying to write a function so when
the user clicks the image, it will remove the row from the
datagrid. The problem I am having is the item renderer sits in its
own file and the DataGrid is in another.
Do I write a private function within the item renderer.mxml
file that will dispatch an event? I think this is only way to do it
as I only want my event dispatched when the user explicitly clicks
the image.
So in my itemRenderer I suppose I would write a function
called "deleteRecord()", this function would dispatch an event and
the file which actually contains the DataGrid would listen for the
event and act accordingly. Is this right?
If so, how would I pass a reference to which row I want to
delete? The itemRenderer sits in its own file and seems to not have
any knowledge of my <mx:DataGrid>
My datagrid code is below which shows how I am using my
itemRenderer
<mx:DataGrid id="myFavoritesDG" x="0" y="0" width="330"
height="110" dragEnabled="false" dropEnabled="true" >
<mx:columns>
<mx:DataGridColumn width="55" dataField="title"
headerText="Action"
itemRenderer="renderers.MyFavoritesItemRenderer" />
</mx:columns>
</mx:DataGrid>
Any help appreciated.
-Westside
Your question is a good one and one a lot of people have.
You are correct in your strategy. Have your itemRenderer use
dispatchEvent, but when you create the event, set its bubbles
parameter to true. This will allow the event to climb up the
component chain. You don't need to have the DataGrid listen for
this event; you just need to listen for it in the place where you
want to use it so you can delete the record.
To get the information you want, make sure your itemRenderer
implements IDropInListItemRenderer. Classes which implement this
will have a listData property and that holds the rowIndex. Check
the documentation for this. If your class doesn't have it,
implement it yourself, the documentation shows you how to do this.
Now that you have the information you'll need to dispatch a
custom event which contains the information. Again, check the docs
for that.
Finally, you will need to use ActionScript to listen for the
event. Let's say the file in which the DataGrid is declared is the
place where you want to listen for the event. Your custom event
won't be an event the DataGrid normally dispatches, so you can't
use MXML to declare the event listener. Instead, do it in
ActionScript:
mygrid.addEventListener( "deleteRecord", handleDeleteRecord
and then declare handleDeleteRecord to have an event
parameter of the type of your custom event.
Similar Messages
-
ICal Alarm - Pass Event data to AppleScript?
Is there a way that a script called by an iCal alarm can be passed event data as parameters?
This is a quick one I knocked up a while back to see if it was possible. The problem is that iCal doesn't tell the script what event triggered it, so you have to go looking ...
click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">(*
called from iCal as on alarm, will speak the title of the alarm event
won't work for repeating events
AK ITCarlow Nov 2004
set Now to current date
-- Adjust FuzzSeconds to suit; if too big, close events will speak several times
set FuzzSeconds to 15
tell application "iCal"
set MyEvents to every event of every calendar where ((start date of it) ≥ (current date))
repeat with ThisEvent in MyEvents --scan the list looking for events that have triggered us
try
set MinutesBefore to (trigger interval of open file alarm of ThisEvent) as number
set TriggerInt to (Now - ((start date of ThisEvent) + 60 * MinutesBefore)) --notionally 0 for firing event
if (TriggerInt < FuzzSeconds) and (TriggerInt > (-FuzzSeconds)) then
say (summary of ThisEvent as text) & " at " & (start date of ThisEvent as text)
--could say other fields too eg location, description ...
end if
end try
end repeat
end tell
</pre>
AK -
How to pass events from enclosed JApplet to enclosing JFrame?
Perhaps a bit of an obscure problem, but I have an application here that involves displaying JApplets within a JFrame. As long as I do nothing to give the displayed JApplet focus, I am able to use keyboard shortcuts to access my various JMenu items. However, the moment I interact with the JApplet and it gets focus (say, by entering text in a JTextField), those keyboard shortcuts no longer work.
I imagine what's happening is that the JApplet assumes that it must be the root component and does not pass events up to the superclass. Is there any way to allow the events to be passed on from the JApplet to the enclosing JFrame? Is this even possible?
Any help would be greatly anticipated.
- FromageHi FTD,
I just about get your example; it is like a containment hierarchy right - one current, one proposed?
If it is required that there is only one base class to maintain, I am positive this can be satisfied. I suppose our ideas are similar... the point I was trying to make though is that you can implement you AnalysisClasses independent of the top-level container it resides in. The JApplet itself perhaps just needs to handle/marshal <applet> parameters (if any) while the JFrame has only JFrame specific initalisation to take care of - this can feasibly be done from the main method of the AnalysisClass. Effectively you get:
JFrame --> JDesktopPane --> JInternalFrame x 3 --> AnalysisClass
or
JApplet --> AnalysisClass
I do not fully understand what role the BaseGUIClass has... in my example, I have omitted it assuming its functionality could be redistributed to AnalysisClass or one of JInternalFrame or JApplet. Does it contain a lot of initialisation code and therefore am I wrong to make this assumption?
'The application GUI itself is simple...', would this be the AnalysisClass and does this mean it can be dropped into a JFrame or JApplet and manage itself? If so, but not to annoy you, I would still recommend the JInternalFrames.
I think it would frustrate me quite a bit if my superiors were rigid... it is very possible to implement this so that there is only one version of a class to maintain. The question is how much programming is required to achieve this. In my opinon, not a lot; perhaps with respect to your bosses/dealines, too much.
Here's an idea:
public class ApplicationGUI extends JApplet
public void initialise()
AnalysisClass tool = null;
switch (Integer.parseInt(getParameter("toolType")))
case 1:
tool = ....
break;
case 2:
tool = ....
break;
case 3:
tool = ....
break;
if (tool != null)
setContentPane(tool);
public void start()
public void stop()
public void destroy()
public static void main(String[] args)
JFrame jFrame = new JFrame("Application Name");
JDesktopPane jDesktop = new JDesktopPane();
JInternalFrame jiFrame1 = new JInternalFrame("Tool 1", true, true, true, true);
JInternalFrame jiFrame2 = new JInternalFrame("Tool 2", true, true, true, true);
JInternalFrame jiFrame3 = new JInternalFrame("Tool 3", true, true, true, true);
jDesktop.add(jiFrame1);
jDesktop.add(jiFrame2);
jDesktop.add(jiFrame3);
jFrame.setContentPane(jDesktop);
jFrame.setVisible(true);
}BTW if you managed to add the JApplet to a JPanel, why couldn't you add it to the JFrame?
Kind regards,
Darren
ps. are you based in England?
pps. apologises for making your name sound like STD, lol
ppps. apologies for posting code when you prob don't want it... I am at work, bored. -
Passing event parameters to copy of DECISION task TS20000118
Hi.
I have made a copy of the decision task TS20000118 which is the standard approve/reject user decision step.
In the decision step, i have a link to ME13 transaction which is done by passing object_id and giving the "display" method as default method for the ZBUS3003 object which takes Info record number as key.
My problem is users are restrcited by PORG auth object in ME13 also and along with Info record number, i have to pass porg, plant, vendor , material to ME13 link.
I have defined event parameters to capture this 4 fields but i dont know where to pass this parameters as TS20000118 where the link appears in using the DECISION object and not the DISPLAY method,.
I dont want to make this 4 fields as object key because it will mean altering many other things. Also, int he DISPLAY method based on info record number i cannot retrieve 4 fields bcos there mioght be multiple records for same info record number.
Appreciate if you can let me know how i can pass event parameters to ME12 link in DECISION step of Task TS20000118 .
Regards
PN.Hello user12628! I have the same problem. Did you solve it? I have dynamically generated size of my Event Parameter String[] mass. And some times I have Error that URL string very long :). That is why I want to use POST method instead GET. if you has found solution,please let me know.
Message was edited by:
kostik -
Passing events - whats wrong with this code?
hi,
I'm trying to get components to behave in a frame like they would as though I had written
frame.getContentPane().add(thecomponent);
by processing events explicitly. I've written the code below as a test, and it does work, but the events do not seem to be passed to the component at the right level.
For example, when the JTree is the component tried it does not expand nodes when you click on them.
Or if you tree a JButton then it doesn't actually visibly "click"
I'm still quite new with Swing so any help would be really appreciated - is this kind of thing even possible?
thanks,
asjf
import javax.swing.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
public class EventTest extends Component
Component notAttached;
class SimpleMouseListener implements MouseListener
String owner;
Component passOnTo;
SimpleMouseListener(String owner, Component passOnTo)
this.owner = owner;
this.passOnTo = passOnTo;
public void mouseClicked(MouseEvent e){passOn(e);}
public void mousePressed(MouseEvent e){passOn(e);}
public void mouseReleased(MouseEvent e){passOn(e);}
public void mouseEntered(MouseEvent e){passOn(e);}
public void mouseExited(MouseEvent e){passOn(e);}
public void passOn(MouseEvent e)
System.out.println(owner+" "+e);
if(passOnTo!=null)
passOnTo.dispatchEvent(
new MouseEvent(passOnTo,
e.getID(),
System.currentTimeMillis(),
e.getModifiers(),
e.getX(), // needs offsetting relative to parent
e.getY(), // needs offsetting relative to parent
e.getClickCount(),
e.isPopupTrigger()
EventTest()
super();
notAttached = new JTree(); //JButton("Hello");
notAttached.setSize(100,100);
notAttached.setVisible(true);
notAttached.addMouseListener(new SimpleMouseListener("unattached component",null));
public void paint(Graphics g){notAttached.paint(g);}
static void main(String [] arg) throws Exception
JFrame frame = new JFrame("Passing events test");
frame.setSize(640,480);
frame.setVisible(true);
EventTest et = new EventTest();
frame.getContentPane().add(et);
frame.addMouseListener(et.new SimpleMouseListener("Frame listener",et.notAttached));
}Sorry
It doesn't compile.
I'm not sure how to create the 6 processes to each add part of sum and then update the total for the next processor to sum the next part up, and i don't know where it goes either.
I think it would be something like:
public void run()
try
//this add it up
total= array + total;
System.out.println("PROCESSOR"+thisnumber+" Your total is " + total);
sleep();
update(total)
and then do the same code for another processor.
I'm confused do I have to name each processor and put the name in :
public void Processor1 ()
please help I'm very confused
} -
my iTunes won't detect my iPhone that has to be restored via iTunes *because if pass code problems* and its running iOS 7.0.4
If itunes is comming up and saying it can't read the device because it's locked with a passcode, you may have to put your device into recovery mode first.
To put your device in recovery mode: (Following these steps will erase your device and reset everything to factory defaults)
1) press and hold the power button until you see the slide to power off option
2) swipe to power off
3) Press and hold the home button while the device is off and connect it to your computer. Continue holding the home button until you see a graphic with the iTunes logo with a picture of a USB cable below it.
4) iTunes should give you a message that it has detected a device in recovery mode. Click ok and then select Restore iPhone. iTunes will download a fresh copy of iOS and then wipe the device and restore it. Depending on the speed of your computer's internet connection this may take a while. Just leave the iphone connected to your computer until it's finished.
If itunes is not detecting it at all or is Not giving you the message that the phone is locked with a passcode, you may end up having to reinstall itunes. This seems to be a fairly common problem after the most recent itunes update (11.1.5)
If this is the case and you happen to be running a windows based computer you will have to uninstall itunes in this order from your programs and features option in control panel:
iTunes
Apple Software Update
Apple Mobile Device Support
Bonjour
Apple Application Support (iTunes 9 or later)
Then download and reinstall itunes from itunes.com try putting your device into recovery mode again and restore.
Hope this helps.
Cheers. -
InputField fire event problem in webDynpro
I have one validation or Fire Event problem with respect to Inputfield in web Dynpro.
I have one Input filed and created the context varible for that, then i mapped the context varible to the InputField, and i changed the context varible type as date.So , when i run the view , it will show the calender near to the text box to select the perticular date. On select of the perticular date. It will populate selected date in to the inputField.
On selection of the perticular date. Based on the date i want to generate the next 12 months date at runtime in different text boxes. But the only event available for the InputField is only "onEnter". This is not useful in my case, bcz on selection of the Date , the user may not use the Enter key. so , how can use the other events like onSelection or onChange events in the InputFields to reach my needs.
Any one give me the idea to solve this problem.
VijayHello Vishal,
You may also refer the sample code in the below link
<a href="http://sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0c0dcacd-0401-0010-b4bd-a05a0b4d68c8">http://sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0c0dcacd-0401-0010-b4bd-a05a0b4d68c8</a>
Regards,
Sudeep. -
Hello again, I have yet another event problem. When I try to use this code I get an error saying Abstract class actionPerformed is not implemented in non- abstract class TableWindow. I'm not quit sure how I'm supposed to implement it.
Here is what I believe to be the relevant code. addWindowListener works but addFocusListener returns the error.
// Table window
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
import javax.swing.event.*;
public class TableWindow extends Frame implements ActionListener
public TableWindow ()
Create Window
super ("Test Window");
setBackground (SystemColor.control);
setLocation (0, 0);
setLayout (new GridLayout (5, 5));
addWindowListener (new WindowAdapter ()
public void windowClosing (WindowEvent e)
try
if (Connected == true)
// Close the Statement
stmt.close ();
// Close the connection
con.close ();
catch (SQLException sqle)
dispose ();
System.exit (0);
tPane = new JTabbedPane ();
tPane.addChangeListener (new ChangeListener ()
public void stateChanged (ChangeEvent c)
//Status.setText ("Clicked");
tablePane = new JPanel ();
recordPane = new JPanel ();
recordPane.addFocusListener(new FocusListener()
public void focusGained(FocusEvent e)
Status.setText ("Clicked");
queryPane = new JPanel ();
TName1 = new TextField (25);
TName2 = new TextField (25);
TName3 = new TextField (25);
idField = new TextField (10);
idField2 = new TextField (10);
TitleField = new TextField (25);
TitleField2 = new TextField (25);
result = new TextArea ("Under Construction", 5, 30);
NewT = new Button ("New Table");
NewR = new Button ("New Record");
NewQ = new Button ("New Query");
NewT.addActionListener (this);
NewR.addActionListener (this);
NewQ.addActionListener (this);
TNameLabel1 = new Label ("Enter name of table here");
TNameLabel2 = new Label ("Enter name of table here");
TNameLabel3 = new Label ("Enter name of table here");
idLabel = new Label ("Enter movie ID here");
TitleLabel = new Label ("Enter title of Movie here");
TitleLabel2 = new Label ("Enter title of Movie here");
tablePane.add (TNameLabel1);
tablePane.add (TName1);
tablePane.add (NewT);
recordPane.add (TNameLabel2);
recordPane.add (TName2);
recordPane.add (idLabel);
recordPane.add (idField);
recordPane.add (TitleLabel);
recordPane.add (TitleField);
recordPane.add (NewR);
//recordPane.add (tableChoice);
queryPane.add (TNameLabel3);
queryPane.add (TName3);
queryPane.add (TitleLabel2);
queryPane.add (TitleField2);
queryPane.add (NewQ);
queryPane.add (result);
Status = new Label ("");
// make the window and add components to it
tPane.addTab ("Table", tablePane);
tPane.addTab ("Record", recordPane);
tPane.addTab ("Query", queryPane);
add (tPane, BorderLayout.CENTER);
add (Status, BorderLayout.SOUTH);
pack ();
setVisible (true);
public static void main (String args [])
ConnectToDatabase ("vdds");
TableWindow tw = new TableWindow ();
} -
Passing events down components in different layers
Hi,
Summary: How to pass events to lower level containers
in a multi layered container system.
This is the scenario which I have
2 Small panels (non overlapping)are added to the content pane using
getContentPane.add(component). Both of them have tool tips associated with them.
Now I am adding semi transparent pane partially overlapping the above two panes and on the top of it. I achieve it by doing
getContentPane.add(component, 0 )
There is no tooltip associated with it.
When I move the mouse over the non-overlapping areas, i get the tool tip associated with the panel. When I move the mouse over the overlapping area. No tool tip comes. Now I would like to display the tool tip based on the component based below the semi transparent , ofcourse depending on whether the mouse is over the overlapping area.
Regards,
RevonHere's an idea:transparentPane.addMouseListener(new MouseAdapter(){
public void mouseEntered(MouseEvent e)
// depending the components 1 and 2's positioning,
// in relation to where mouse is over transparentPane,
// you can determine who to fowaredEvent to
if(mouseOnTopOfComponent1)
fowardEvent(component1, e);
else if(mouseOnTopOfComponent2)
fowardEvent(component2, e);
private void forwardEvent(Component c, MouseEvent e)
c.dispatchEvent(new MouseEvent(c, e.getID(),
e.getWhen(),
e.getModifiers(),
e.getX(), e.getY(),
e.getClickCount(),
e.isPopupTrigger()));
} -
I am fairly new to LabVIEW and I am trying to make a GUI that uses
events to pass messages between three separate event loops, GUI,
Messaging and Logging. GUI controls the state of the other two event
loops by generating control events and using semaphores. While the
messaging semaphore is released by the GUI, Messaging generates
messages and raises them as events. Some message events are handled by
the GUI event loop and others by the Logging event loop. Logging, once
it receives a 'logging ON' control event dynamically registers for
certain message events and logs the message events it handles to file.
When Logging receives a 'logging OFF' control event, it dynamically
unregisters the message events. The logging control events are
registered for the life of the Logging event loop.
I have created a cut-down version of my GUI that exhibits the same
problem. The problem is that after I have turned Logging on and off
once, it no longer responds to logging control events from the GUI.
Even though the GUI is still generating the events. I have looked at
the dynamic logging example in LabVIEW and thought I did the same sort
of thing but I just can't get it to work that way. The only way I got
it working was by creating a clean event registration with all events
each time I want to change the event registration. This is how I have
done it in the example file and it works. But I don't want to use this
method, I don't want to have to re-register the control events each
time I unregister/register message events.
If anyone knows what I'm doing wrong please edit the example vis and post them back.
Notes for the example:
Files are LabVIEW 7.1.1
Just open the front panels for all the vis before running the GUI vi.
The Display vi just does the same thing as the logging vi.
Run the GUI vi and turn on Messaging then turn Logging on and off a few times.
The example works, but if you wire the event registration refnum
input when doing dynamic event registration, Logging will only turn on
and off once, then no longer respond to log control events... what's
going on?I can't tell you how to solve you problems - without code this is always quite tricky.
But in case you want to log messages to a log file, have a look at this thread
http://forums.ni.com/ni/board/message?board.id=170&message.id=172117&view=by_date_ascending&page=1
where I posted a logging-library.
Maybe it is a useful help for you.
Thomas
Using LV8.0
Don't be afraid to rate a good answer... -
Flex 3 Passing Event Info via Metadata
As an opener, I am a complete new Flex user and a total novice. This is my first crack at it and first post. Now my problem, I am modifying and updating some existing Flex 3 code using the SDK. I have completed all updates save one, The Alert messages HAVE NEVER WORKED, so I am trying to get those working.
The application uses a parent mxml file, FileUploadApp.mxml which sets the stage and a canvas.
That file uses a subordinate mxml file, FileUpload.mxml does all the work and places items on the canvas.
FileUpload.swf is created, then included in FileUploadApp.swf. Everything works except the Alert messages. Communication from FileUploadApp.swf is as two fold:
1) variables and constants are defined in FileUploadApp and used by FileUpload.
2) evemts are defined in FileUpload and passed back to FileUploadApp via metadata. All events are being passed back except button/mouse events.
FileUploadApp code:
<mx:Canvas width="400" height="300" horizontalCenter="0" verticalCenter="0">
<com:FileUpload
width="100%" height="100%"
uploadUrl="{_strUploadScript}"
uploadComplete="Alert.show('File(s) have been uploaded.', 'Upload successful')"
uploadIOError="Alert.show('IO Error in uploading file.', 'Error')"
uploadHTTPError="Alert.show('Upload Server Connection Lost.', 'Upload Failure')"
uploadSecurityError="Alert.show('Security Error in uploading file.', 'Error')"
btnCancel="Alert.show('You have canceled this upload.', 'Upload Cancled')"/>
</mx:Canvas>
FileUpload code:
<mx:Metadata>
[Event(name="uploadComplete", type="flash.events.Event")]
[Event(name="uploadProgress", type="flash.events.ProgressEvent")]
[Event(name="uploadCancel", type="flash.events.Event")]
[Event(name="uploadIOError", type="flash.events.IOErrorEvent")]
[Event(name="uploadHTTPError", type="flash.events.HTTPStatusEvent")]
[Event(name="uploadSecurityError", type="flash.events.SecurityErrorEvent")]
[Event(name="btnCancel", type="flash.events.MouseEvent")]
</mx:Metadata>
btnCancel.addEventListener(MouseEvent.CLICK, onbtnCancelClick);
var mevt:MouseEvent = new MouseEvent("btnCancel");
dispatchEvent(mevt);
<mx:Button id="btnCancel" toolTip="Cancel upload" icon="@Embed('assets/cancel2.png')" width="26" click="onbtnCancelClick()"/>
When the "btnCancel" button is clicked, the user should get the Alert message "Upload Cancled'. All the other Alerts from events except the button events are being displayed.
Any help will be appreciated.rtalton
There are two mxml files:
FileUploadApp.mxml => Sets the stage, some constants, some variables, all the Alerts from events and the canvas.
There is a subordinate file, FileUpload.mxml => does all the work, has the images that are placed on the canvas and processes all events, but passes the events back to FileUploadApp.mxml to process the Alerts.
FileUpload.mxml is compiled to FileUpload.swf and included into FileUploadApp.swf, all in the same compile. Only FileUploadApp.swf is used in the Flash Player.
Do no know why this path was chosen, as in my original message, this is code I am modifying and updating. I have everything else running correctly except the Alerts. I tried moving all Alert processing to FileUpload.mxml to avoid passing the event through metadata, but no joy. The Alerts have to be processed where the original blank canvas is defined, that is FileUploadApp.mxml. -
Creation of an event : problem with the container
Hi Gurus,
I'm facing a problem in creation of an event.
I'm in SAP ECC 6.0 for a migration project from 4.6B
In an ABAP program I'm trying to create an event in order to launch a workflow.
1st step : Set datas in the container -> In INTERNAL_TABLE I have 5 lines.
swc_set_table event_container 'INTERNAL_TABLE' t_cnp_container.
2nd step : Create an event :
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = w_wf_objtype
objkey = w_wf_objkey
event = w_wf_event
creator = applicant
start_recfb_synchron = 'X'
TABLES
event_container = event_container
EXCEPTIONS
objtype_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE sy-subrc.
ENDIF.
Now when I check my container with SWI2_FREQ I see that INTERNAL_TABLE has just one ligne, the rest disapears.
I have this problem only when I set an internal table in an container
I don't know why, but it perfectly works on 4.6B.
Thanks a lot
WalidHi,
I dont see a point in having this statement
swc_set_table event_container 'INTERNAL_TABLE' t_cnp_container. Infact it is not needed !!
SWE_EVENT_CREATE like any other FM, take a
lt_var type standard table of SWCONT.
ls_var type SWCONT.
fill your ls_var with all fields and append it to lt_var each time and pass lt_var to event_table of SWE_EVENT_CREATE. It should work !!
However, suggested way is to use SAP_WAPI_CREATE_EVENT instead of SWE_EVENT_CREATE from ECC 5.0 onwards. There are fe concerns with SWE_EVENT_CREATE mainly with respect to commit and persistancy. Better we should use SAP_WAPI* as much as possible from ECC 5.0.
Try above and Good Luck !!
Regards
Krishna Mohan -
ALV Tree - register event problem
Hi,
I'm trying to register standard events for ALV Tree. when perform register_events it raises exception 'illegal event combination'. does anybody know what is wrong it this code ?
***INCLUDE ZNT_SLORDERHIER_STATUS_0100O01 .
*& Module STATUS_0100 OUTPUT
* text
module STATUS_0100 output.
set pf-status 'MAIN100'.
if tree1 is initial.
perform f_init_tree.
endif.
call method cl_gui_cfw=>flush.
endmodule. " STATUS_0100 OUTPUT
form register_events.
* define the events which will be passed to the backend
data: lt_events type cntl_simple_events,
l_event type cntl_simple_event.
* define the events which will be passed to the backend
l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
append l_event to lt_events.
call method tree1->set_registered_events
exporting
events = lt_events
exceptions
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
if sy-subrc <> 0.
call function 'POPUP_TO_DISPLAY_TEXT_LO'
exporting
titel = 'Error number:'
textline1 = sy-subrc
start_column = 1
start_row = 6. "#EC NOTEXT
endif.
endform. " register_events
form f_init_tree.
perform f_build_fieldcatalog.
* create container for alv-tree
data: l_tree_container_name(30) type c,
l_custom_container type ref to cl_gui_custom_container.
l_tree_container_name = 'TREE1'.
if sy-batch is initial.
create object l_custom_container
exporting
container_name = l_tree_container_name
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
if sy-subrc <> 0.
message x208(00) with 'ERROR'. "#EC NOTEXT
endif.
endif.
* create tree control
create object tree1
exporting
parent = l_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
item_selection = space
no_html_header = ''
no_toolbar = ''
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
if sy-subrc <> 0.
message x208(00) with 'ERROR'. "#EC NOTEXT
endif.
* create Hierarchy-header
data l_hierarchy_header type treev_hhdr.
perform f_build_hierarchy_header changing l_hierarchy_header.
* create info-table for html-header
data: lt_list_commentary type slis_t_listheader,
l_logo type sdydo_value.
perform f_build_comment using
lt_list_commentary
l_logo.
* repid for saving variants
data: ls_variant type disvariant.
ls_variant-report = sy-repid.
CLEAR gt_sorder[].
* create emty tree-control
call method tree1->set_table_for_first_display
exporting
is_hierarchy_header = l_hierarchy_header
it_list_commentary = lt_list_commentary
i_logo = l_logo
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = ls_variant
changing
it_outtab = gt_sorder "table must be emty !!
it_fieldcatalog = gt_fieldcatalog.
* create hierarchy
perform f_create_hierarchy.
perform register_events.
endform. " init_tree
form f_build_fieldcatalog.
DATA gs_fieldcat LIKE LINE OF gt_fieldcatalog.
* get fieldcatalog
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'ZVNT_SLALVTREE'
changing
ct_fieldcat = gt_fieldcatalog.
clear gs_fieldcat.
endform.
form f_build_hierarchy_header changing
p_hierarchy_header type treev_hhdr.
p_hierarchy_header-heading = 'Hierarchy Header'. "#EC NOTEXT
p_hierarchy_header-tooltip =
'This is the Hierarchy Header !'. "#EC NOTEXT
p_hierarchy_header-width = 30.
p_hierarchy_header-width_pix = ''.
endform.
form f_build_comment using
pt_list_commentary type slis_t_listheader
p_logo type sdydo_value.
data: ls_line type slis_listheader.
* LIST HEADING LINE: TYPE H
clear ls_line.
ls_line-typ = 'H'.
* LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'ALV-tree: sales order-overview'. "#EC NOTEXT
append ls_line to pt_list_commentary.
* STATUS LINE: TYPE S
p_logo = 'ENJOYSAP_LOGO'.
endform. "build_comment
form f_create_hierarchy.
data: ls_sorder type ty_ZVNT_SLALVTREE,
lt_sorder type ty_ZVNT_SLALVTREE occurs 0.
* get data
select * from ZVNT_SLALVTREE into table lt_sorder up to 200 rows WHERE spras = sy-langu and matnr in s_matnr
and vbeln in s_vbeln.
sort lt_sorder by vbeln.
* add data to tree
data: l_vbeln_key type lvc_nkey,
l_posnr_key type lvc_nkey,
l_last_key type lvc_nkey.
loop at lt_sorder into ls_sorder.
on change of ls_sorder-vbeln.
perform f_add_vbeln_line using ls_sorder
changing l_vbeln_key.
endon.
on change of ls_sorder-posnr.
perform f_add_posnr_line using ls_sorder
l_vbeln_key
changing l_posnr_key.
endon.
perform f_add_complete_line using ls_sorder
l_posnr_key
changing l_last_key.
endloop.
* this method must be called to send the data to the frontend
call method tree1->frontend_update.
endform. " create_hierarchy
form f_add_vbeln_line using ps_sorder type ty_ZVNT_SLALVTREE
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_sorder type ty_ZVNT_SLALVTREE.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3P@'.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-style =
cl_gui_column_tree=>style_intensifd_critical.
append ls_item_layout to lt_item_layout.
* add node
l_node_text = ps_sorder-vbeln.
data: ls_node type lvc_s_layn.
ls_node-n_image = space.
ls_node-exp_image = space.
call method tree1->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sorder
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform.
form f_add_posnr_line using ps_sorder type ty_ZVNT_SLALVTREE
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_sorder type ty_ZVNT_SLALVTREE.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3Y@'.
ls_item_layout-style =
cl_gui_column_tree=>style_intensified.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
append ls_item_layout to lt_item_layout.
* add node
l_node_text = ps_sorder-posnr.
data: relat type int4.
relat = cl_gui_column_tree=>relat_last_child.
call method tree1->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = relat
i_node_text = l_node_text
is_outtab_line = ls_sorder
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform. " add_connid_line
form f_add_complete_line using ps_sorder type ty_ZVNT_SLALVTREE
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_item_layout-editable = 'X'.
append ls_item_layout to lt_item_layout.
l_node_text = ps_sorder-posnr.
data: ls_node type lvc_s_layn.
ls_node-n_image = space.
ls_node-exp_image = space.
call method tree1->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = ps_sorder
i_node_text = l_node_text
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform. " add_complete_line
form exit_program.
call method tree1->free.
leave program.
endform.
Code Formatted by: Alvaro Tejada Galindo on Feb 14, 2008 9:54 AM
Edited by: Lukasz Sekowski on Feb 14, 2008 4:11 PMI've finally fixed the problem:
there was:
item_selection = space
and should be:
item_selection = 'X' -
MSS Teamviewer Eventing problem
Hi,
I am working on Teamviewer eventing. Here is my complete JSP page code. All I am trying to do is pass the data from client event back to server side Dynpage. I am getting an error on bottom status bar that "objected expected" on the line "var inputfield = eval(func("pernr"));" Can anyone tell what could be the problem ?
<jsp:useBean id="myBean" scope="application" class="com.wrigley.evt.EvtBean" />
<hbj:content id="myContext" >
<hbj:page title="PageTitle">
<hbj:form id="myFormId" >
<hbj:inputField
id="pernr"
type="string"
maxlength="20"
value=""
visible="FALSE"
jsObjectNeeded="true">
</hbj:inputField>
</hbj:form>
</hbj:page>
</hbj:content>
<script language="javascript">
EPCM.subscribeEvent("urn:com.sap.pct.hcm.orgmanagement:CurrentObject", "objectChanged", receiveEvent);
function receiveEvent(Evt) {
var pernr = Evt.dataObject;
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
var inputfield = eval(func("pernr"));
if (inputfield)
inputfield.setValue(pernr);
var form = document.all(htmlb_formid);
form.submit();
</script>
<%=myBean.getCW1()%>Hi Sudheer,
You are missing the following line at the top of jsp page.
<%@ taglib uri="tagLib" prefix="hbj" %>
Also add the following lines to your portalapp.xml
<component-profile>
<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
</component-profile>
Venkat: you are guessing? -
Events problem with (Java and ActiveX)
Hi,
I use an ActiveX component with Java and i've got a problem with events.
Java classes were generated with Bridge2Java (IBM).
In order to manage events I added a listener in my application :
javaMyActiveX = new MyActiveX();
javaMyActiveX.add_DMyActiveXEventsListener(new _DMyActiveXEventsAdapter());
I also added a constructor in the _DMyActiveXEventsAdapter class and I fill the body of methods.
The ActiveX generates two types of events :
- The ones are directly generated by methods.
- The others are generated by a thread.
With MS Products (VB, Visual C++, Visual J++), I catch all events.
With java (jdk 1.4), I catch only events generated by methods.
Can anyone help me.I'm not 100% sure, but the last time I used that bridge, it only worked if you ran your Java app within a Microsoft VM.
Maybe you are looking for
-
Html5 previews fine but doesn't open online
My project previews fine in html5 and plays locally in all browsers, but won't open online in any browser. I just get a dark screen. The flash version works online. Any ideas why the html 5 would play locally but not on the web?
-
Photoshop CS5 keeps crashing on me-
I'm using a Macbook Pro with 3GB of RAM running OS X 10.5.8. PS CS5 crashes often. I first saw this when I would try to merge several images to HDR Pro. Sometimes it crashed before I got to the HDR editor. Sometimes it crashed after the editor wh
-
How can I format a cell in Numbers to have leading zeros in a number?
I imported a spreadsheet from Excel (Office 2014, Win 7) through iCloud and some numbers were formatted to have leading zeros (012358) in the original Excel file but the leading zero format was lost in Numbers. Is there a way to format cells to have
-
How can read the mouse (optical ps/2) signal?
Dear All How can the LabView read the mouse (optical ps/2) signal, and deal with it as input signal to be able to used the mouse signal to specify DaNI robot position?
-
Reinstalling Tiger: Some Questions
My Appologies if this has been covered before. Something is broken on my system. I'm not sure exactly what it is but there are certain software applications that cause kernal panics on my system while working fine on other systems running 10.4.11. I'