Handling events in sub VIS
I am trying to capture the events in a sub VI. But somehow the event is not being captured.
Thanks in Advance
LabVIEWan
Attachments:
New Folder (2).zip 42 KB
That is my puzzled look.
Since we missed the mark and now you are off in a new direction... Could you please stop and describe what you are looking for so we don't waste your time?
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction
Similar Messages
-
Handling User Events in sub panel vis and main vis with same Event reference Number.
Hi All, Iam trying to work to handle events in both subpanel vi and main vi.
I have a main program, and 2 sub vi. I will load the sub VI in 2 sub panels in main vi. Each sub pael vi has controls on it.
I have created 2 User events for 2 sub panels vi. One user event consits of a Cluster with 2 Booleans (x & Y) and Other User Event consists of cluster of 2 unsigned 8 Numbers (a & b). These are created and registered in the main Vi and event register refnum is passed to the subpanel vi from the main panel vi.
I have Event structure in main panel and sub panel vis.
In one sub panel vi, When the value of one boolean(i.e. X) in the clusters changes, the Events structure in sub panel vi should perform some operation in sub panel vi only. When the value of other boolean (i.e. Y) changes it should perform some operation in main vi. I will try to Generate user event with the x value and Y value changed based on the control clicks in the sub panel vi.
The OTher panel vi should behave in the smae way when the a & b value changes.
The "Generate User Event" is working fine some times and sometimes there in no event triggered in the sub panel vi or main vi.
Please let me know what is the problem Ramesh.There is a lot of talking, but not much understanding. It'd be better if you posted some example VI's of what you are trying to do so that the words will make sense.
One thing I can tell you is that you don't want to have two event structures handle the same event reference number. You want to have two event registrations with each one going to its own event structure. -
Will more function globals or sub vis slow down realtime DAQ or display
I need to do high sampling rate DAQ with varient data process and display.
Shall I intend to put all the code into one vi to accelarate the speed, or can I use more function global or sub vis to make the structure looks more reasonable.
Just worry how the compiler handle the data transfer when call function global or sub vis.
Will it creat new data copy and slow down the speed. Thanks.The other 2 loops in charge of the data processing and display will keep checking the version of the 2 function global.
For high performance, you want to avoid this sort of thing. Basically, you're polling the functional global to see if it has new data. Polling will eat the CPU unless you include WAIT periods, but doing that slows your responsiveness.
Consider using custom events.
For the sake of discussion, let's say you need to process data in the TIME domain (1) and the FREQUENCY domain (2).
You create two events: NEW TIME DATA and NEW FREQ DATA, each carrying an array of DBL (the time-domain data from the DAQ).
The DAQ routine, when it gets a new data block fires both these events, feeding it the new data.
Your TIME DOMAIN loop (1) has registered for one event. When that event is triggered, the code accepts the data, and does whatever it needs to do (filters the time domain, graphs it, writes to file, averages, whatever).
Another loop (2) has registered for the OTHER event. When THAT event is triggered, the code accepts the data, performs FFT on it, and does whatever it needs to do (filters the frequency domain, graphs it, writes to file, averages, whatever).
Or you could do the same thing with queues.
When the use changes conditions, you change which event you listen to, or which queue you consume from.
The idea is that you want to avoid polling. Let the system tell YOU when data is available. Don't be asking the system if it's available.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And Tricks -
Handling Events in FXML-includes
Hi!
I am using FXML to define the GUI of my application. As the GUI is pretty complex with many regions and items in it, I have created a separate FXML file for each main region to reduce the overall complexity of maintaining the design.
My parent FXML file, called "Frame.xml", includes those "sub-regional" FXML-definitions using "<fx:include source="RegionXYZ.fxml" />".
What I am now stucked with is, how to handle events in this approach...
Questions:
a) Can I add a separate controller in each of the "sub-regional" FXML-files, like "fx:controller="FXMLRegionXYZController"?
b) Or must I, or even should I, use only a single controller inside the main FXML? Will this single controller be able to recognize and handle actions/events in the included FXML-definitions as well?
c) What is the best approach in general for this?
Thanks,
JörnHi!
I am using FXML to define the GUI of my application. As the GUI is pretty complex with many regions and items in it, I have created a separate FXML file for each main region to reduce the overall complexity of maintaining the design.
My parent FXML file, called "Frame.xml", includes those "sub-regional" FXML-definitions using "<fx:include source="RegionXYZ.fxml" />".
What I am now stucked with is, how to handle events in this approach...
Questions:
a) Can I add a separate controller in each of the "sub-regional" FXML-files, like "fx:controller="FXMLRegionXYZController"?
- Yes, you can
b) Or must I, or even should I, use only a single controller inside the main FXML? Will this single controller be able to recognize and handle actions/events in the included FXML-definitions as well?
- if you could control everything from a single controller but you option (A) is much better
c) What is the best approach in general for this?
- Option (a)
Thanks,
Jörn -
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 open page in new window while handling event on link.
Hi all
I have a requirement where page should be opened in new window when I click on link.My item style is 'link'.Despite of mentioning target frame _blank, I m not able to open it in new window.I m handling event by setting Action Type as fireAction.I hope this might be the reason because of that this happened. Can somebody suggest some solution so that I can open it in new window.
Thanks,
BhupendraHi ,
though i am not able to answer, i can get some answer for my question.
How the link item is handled thru the ActionType and event in the Client Action..?
The reason for this question is that we are trying to extend the customer search page in AR - EBSR12. there the search result page has the Account Name as a link and the Action event says viewAccountName and the action type says firePartialAction. I am trying to understand this so that i can add more parameters to the link so that i can use them in the target page of the link..
Any help is appreciated..
Thanks
Chidam -
Using Open VI Reference to run a VI, on an RT target, with sub-VIs not loaded
I've been using Open VI Reference and Call By Reference Node to remotely run VIs on my RT controller. I
usually wire string data to the vi path input, but this
requires the VI to be in memory. I understand (from LabVIEW help) that I can wire a path to this terminal and specify a VI that is
not in memory, but is on the disk. NI has an example that
confirms my understanding. I get errors when I attempt to do the same
with VIs that have sub-VIs; I suspect that the problem is that
the sub-VIs aren't in memory and that the top-level vi doesn't know where to
look for them (because the paths aren't specified). All of the sub-VIs are on the RT system (in the same directory), they're just not in memory.
Is there a way to get LabVIEW to look for sub-VIs on the disk? I don't want to rely on using a startup application and rebooting to get my VIs into memory.
Thank you,
Jim Carmody
Software Engineer
G2 Technologies
www.g2tek.com
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ AliceHi Jim,
It sounds like you are going about calling VIs remotely the correct way. It would be very helpful if you could post the errors you are receiving. I also wanted to know if you saw the note at the bottom of the article that says your VI library must contain everything your top level VI calls.
Eric A.
National Instruments
Distributed I/O Product Support Engineer -
Hi!
I would like to know which one of the following is the best way to handle events in Swing application.
Method 1
Write annonymus inner classes in the same class
Method 2
=======
Write a seperate class which extends the adapter class of the event handling and create an object of that in the main class and assign it to the components with addActionHandler() method.
I am trying to use the second one and I have the following design issue.
I have a class frmMain.java in which I have a frame and to that frame I am adding a panel which consists of 'N' No. of components.
I want to make this panel added to the frame when I click on a menu item (login) and want to remove the panel from frame when I click on a menu item(logout).
I have a main class called Application.java where I create the object of my frame(frmMain.java).
Thanks in advance,
AV1. Your JFrame is now subject to receive action events from anywhere. You will have to be more careful that you respond only to the right events.
2. If you have a lot of possible consequences to an event(for example, based on button pressed), you'll need a long if...then...else statement to determine what to do based on the source of the event.
3. With individual ActionListener classes, it's easier to add the same listener to multiple components and no need to worry about source.
4. Kind of the same thing: With individual classes, the event and its consequences are so tightly coupled.
End preaching....basically, my style boils down to what I call the tool set vs Swiss army knife rule. Java seems designed around the concept of a large number of specific purpose classes vs a smaller number of multi purpose classes and I think its a design methodology that makes sense, because I believe strongly in functional isolation in my code. -
I would like to know how i can create a bell graph with out using sub VIs, the data that i created consists in 500 readings with values of 0 to 100, i calculated the mean value and standard diviation. I hope some one can help me
Here's a quick example I threw together that generates a sort-of-bell-curve shaped data distribution, then performs the binning and plotting.
-Kevin P.
Message Edited by Kevin Price on 12-01-2006 02:42 PM
Attachments:
Binning example.vi 51 KB
Binning example.png 12 KB -
Dynamic Creation of list box on excel sheet and handling events
hi all ,
i m working on excel to sap integration application and for that i need to create dynmicaly list boxes in excel and also needs to handler events of each boxes..
please suggest me somehting asap/
thanks in advance,
jigs
helpful ans will be rewarded.hi all ,
i m working on excel to sap integration application and for that i need to create dynmicaly list boxes in excel and also needs to handler events of each boxes..
please suggest me somehting asap/
thanks in advance,
jigs
helpful ans will be rewarded. -
hi,
Hi,
I am displaying some fields from VBAP in ALV gid and have give drop down check box to storage location making it editable so if the user changes Storage location of
some entries and clicks SAVE button, when we click save button i need to capture all the rows that were been changed and update VA02 using these records through bapi.
but iam not able to capture this SAVE event but iam able to capture Enter and cursor event.
i have written following code for this
LOCAL CLASSES: Definition
class lcl_event_receiver: local class to handle event CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
PRIVATE SECTION.
ENDCLASS. "lcl_event_receiver DEFINITION
LOCAL CLASSES: Implementation
class lcl_event_receiver (Implementation)
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
DATA: l_error_in_data TYPE c.
PERFORM handle_data_changed USING er_data_changed l_error_in_data.
*§7.Display application log if an error has occured.
IF l_error_in_data EQ 'X'.
CALL METHOD er_data_changed->display_protocol.
ENDIF.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
*& Form handle_data_changed
Identify columns which were changed and check input
-->P_ER_DATA_CHANGED text
FORM handle_data_changed USING p_er_data_changed
TYPE REF TO cl_alv_changed_data_protocol
p_error_in_data TYPE c.
DATA : lw_mod_cell TYPE lvc_s_modi ,
l_value TYPE lvc_value ,
l_lgort TYPE lgort_d.
SORT p_er_data_changed->mt_mod_cells BY row_id .
LOOP AT p_er_data_changed->mt_mod_cells INTO lw_mod_cell
WHERE fieldname = 'LGORT'.
CALL METHOD p_er_data_changed->get_cell_value
EXPORTING
i_row_id = lw_mod_cell-row_id
i_fieldname = 'LGORT'
IMPORTING
e_value = l_value.
SELECT SINGLE lgort FROM t001l INTO l_lgort WHERE werks = p_werks
AND lgort = l_value.
IF sy-subrc NE 0.
In case of error, create a protocol entry in the *application log.
CALL METHOD p_er_data_changed->add_protocol_entry
EXPORTING
i_msgid = '0K'
i_msgno = '000'
i_msgty = 'E'
i_msgv1 = text-003
i_msgv2 = l_value
i_msgv3 = text-004
i_fieldname = lw_mod_cell-fieldname
i_row_id = lw_mod_cell-row_id.
p_error_in_data = 'X'.
EXIT.
ELSE.
*§5b.If the value is valid change values of
cells.
CALL METHOD p_er_data_changed->modify_cell
EXPORTING
i_row_id = lw_mod_cell-row_id
i_fieldname = lw_mod_cell-fieldname
i_value = l_value.
READ TABLE t_list1 INTO w_list1 INDEX lw_mod_cell-row_id.
IF sy-subrc EQ 0.
*comparing old value with the changed value
IF w_list1-lgort <> l_value.
MOVE: w_list1-werks TO w_list3-werks,
w_list1-matnr TO w_list3-matnr,
w_list1-arktx TO w_list3-arktx,
w_list1-vbeln TO w_list3-vbeln,
w_list1-posnr TO w_list3-posnr,
w_list1-pstyv TO w_list3-pstyv,
w_list1-vstel TO w_list3-vstel,
w_list1-auart TO w_list3-auart,
w_list1-kwmeng TO w_list3-kwmeng,
w_list1-vrkme TO w_list3-vrkme,
w_list1-mbdat TO w_list3-mbdat,
l_value TO w_list3-lgort.
APPEND w_list3 TO t_list3.
*t_list3 will contain all the records that are changed
CLEAR w_list3.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF go_custom_container IS INITIAL.
create a custom container control for our ALV Control
CREATE OBJECT go_custom_container
EXPORTING
container_name = g_cont_on_main
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
Display error message.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = sy-repid
txt2 = sy-subrc
txt1 = 'The control could not be created'.
ENDIF.
create an instance of alv control
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
*If display or change radio button is cheked
IF ( p_chng = 'X' OR p_disp = 'X' ) .
Set a titlebar for the grid control
g_layout-grid_title = 'Sales Orders'.
g_layout-excp_fname = 'TRAFFIC_LIGHT'.
Define a drop down table.
PERFORM set_drdn_table.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
is_layout = g_layout
CHANGING
it_outtab = t_list1
it_fieldcatalog = t_fieldcat1
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
register ENTER and CURSOR to raise event DATA_CHANGED.
(Per default the user may check data by using the check icon).
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
CREATE OBJECT g_event_receiver.
SET HANDLER g_event_receiver->handle_double_click FOR go_grid.
SET HANDLER g_event_receiver->handle_hotspot_click FOR go_grid .
SET HANDLER g_event_receiver->handle_data_changed FOR go_grid .
ENDIF.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = go_grid.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
WHEN 'SAVE'.
PERFORM update_sales_order using t_list3[].
endcase.
Thanks in Advance,
SiriHi Sirisha,
You can get the event code for Enter because you have regitered in the event reciever .
But for the SAVE you will have to set in the PF-status of the screen and not the ALV-grid save .
Please award if helpful. -
Hi,
I am currently working on a project which involves a large chunk of Labview programming. I am new to Labview but am relatively experienced with C. I have designed an algorithm for C that I am currently trying to "translate" into Labview. The algorithm I have designed is a very modular piece of code, I have used a lot of smaller functions and called them in main rather than writing the entirety of the code in main.
My problem is that I don't really understand the difference between Labview projects and using one main VI to call other subVIs. I am unaware of whether I would be better off using sub VIs held together in one main VI or would I be better to use a Labview project. I am on a very tight schedule as it is a rather large project so I don't have a lot of time to experiment with my code-writing.
Does anyone have any advice on which approach is better/easier for an inexperienced user or if they are both pretty much the same?
GillianProjects and subVIs are completely unrelated concepts.
The project is a means of organizing all the parts of the system you need to develop a program and build it into an executable.
A subVI is just any VI which is used as a part of another VI.
You need both. When you open LabVIEW to start writing your code, create a new project and then keep your main VI and all subVIs and other parts like customized controls in the project. Since you are an experienced programmer and have a modular design for the implementation of your algorithm, you can move those concepts directly to LV.
SubVIs should be logical groupings of code such as the smaller functions in your algorithm. The entire algorithm could be contained in a subVI which has those functions as subVis in the algorithm VI.
Lynn -
Hello,
I'm very much confused about the handling events of JComboBox with ActionListener and ItemListener. Both are seemed similar to me. If anyone can explain me the differences, it would be helpful for me. Thanks everybody.ActionEvents are fired each time any item is selected, ItemEvents are only fired, if the selection changes.
-
Handling Events in CMSDK webapplication
Hi frns,
I am handling events(create Directory,delete directory,
move Folder,upload document etc.)and forward it(that a folder had been created,a file had been deleted etc.)to all the users who are currently logged on webapplication.
To do that I have to create a custom server(extending IfsServer and implementing IfsEventHandler)and deploy it
in the node using CMSDK manager,now my queries are:
a)Shall I override the initialize()method of the Server
?If yes,then what will be the signature of initialize()?
b)What about all others method of server lifecycle?
c)What are the other steps(like display the msg.regarding the events to all the logged on users)to be taken?
Plz send me the answers as early as possible.
Regards,
Prasenjitcebailey wrote:
Here's a version with Panel > OwningVI > Key Down selected in the nodes that register events. It seems to do what I want. It acts on keystrokes that occur when the cursor isn't even over the parent's window, which is good in my situation. I made these choices by experimenting - is this a good approach, if I want to act on all the keystrokes that occur when the parent VI has focus?
As you noted, this will have the event structure respond to keypresses whenever the parent VI is active. You can simplify the subVI by simply wiring the "VI Refnum" terminal directly to the Register for Events node. Getting the Panel, and then the Owning VI simply gets you back to where you started.
That's a valid way of doing it, and I'm assuming that this is intended to be a test case. As you noted you have a large project, so I don't know what your overall architecture is, or how you intend to use this technique, so I can't really say whether it's a "good" approach. It's an approach.
Say, I should have said this before, but you have to be pretty good to answer the question somebody should be asking, especially in brief forum postings.
Thanks for the compliment. It's just a matter of seeing a lot of code and a lot of questions. I'm only a teenage pup compared to the real veterans on this board. -
Handling events in subvis - think this should work but it doesn't.
In part of a large project I need to handle key down events, but elsewhere I need to handle them differently and want to be able to dynamically register and unregister them in each location. I also want to be able to put one of the event handlers in a subvi. To quote the Help system, "Dynamically Registering Events: With dynamic registration, you can handle events in a subVI rather than only in the VI where the events are generated."
ViThatHandlesEvents.vi handles key down events. It uses dynamic event registration to demonstrate that it works (though in this simple example it isn't necessary).
ViContainingSubviThatHandlesEvents registers key down events and passes this to KeyDnEventHndlrSubVI. I thought it would work but it doesn't.
Attachments:
KeyDnEventHndlrSubVI.vi 14 KB
ViThatHandlesEvent.vi 22 KB
ViContainingSubviThatHandlesEvent.vi 18 KBcebailey wrote:
Here's a version with Panel > OwningVI > Key Down selected in the nodes that register events. It seems to do what I want. It acts on keystrokes that occur when the cursor isn't even over the parent's window, which is good in my situation. I made these choices by experimenting - is this a good approach, if I want to act on all the keystrokes that occur when the parent VI has focus?
As you noted, this will have the event structure respond to keypresses whenever the parent VI is active. You can simplify the subVI by simply wiring the "VI Refnum" terminal directly to the Register for Events node. Getting the Panel, and then the Owning VI simply gets you back to where you started.
That's a valid way of doing it, and I'm assuming that this is intended to be a test case. As you noted you have a large project, so I don't know what your overall architecture is, or how you intend to use this technique, so I can't really say whether it's a "good" approach. It's an approach.
Say, I should have said this before, but you have to be pretty good to answer the question somebody should be asking, especially in brief forum postings.
Thanks for the compliment. It's just a matter of seeing a lot of code and a lot of questions. I'm only a teenage pup compared to the real veterans on this board.
Maybe you are looking for
-
I am using TABLE(CAST()) operation in PL/SQL and it is returning me no data. Here is what I have done: 1. Created Record type CREATE OR REPLACE TYPE target_rec AS OBJECT target__id NUMBER(10), target_entity_id NUMBER(10), dd CH
-
Actions and ActionListeners as parameters
Hi everybody, I want to overload a method so it can take either 2 Actions, 2 ActionListeners, or one of each. The issue with this is that I'd have to make 4 overloaded signatures and almost identical methods, like this: method( action, action ) metho
-
Converting Process order Idoc to Post a Purchase order
Hi, we have a requirement where we will get a Process order IDOC that is LOIPRO as an inbound IDOC. We need to use the IDOC to create a purchase order. Can anybody suggest what can be done. Sender system sends LOIPRO. Recieving system recieves it and
-
SOA Suite 11g - Connection Pools constantly getting suspended...
Hi, I have composites, bpel processes using database adapters. *I keep getting "+Pool mds-owsm is Suspended, cannot allocate resources to applications+" and " Pool SOALocalTxDataSource is Suspended, cannot allocate resources to applications.." in so
-
I'm new to Itunes and still learning the software. My problem is I have many song titles listed in the library which are not vaild because I think I deleted the songs or moved them elsewhere. What do I need to do to fix the concern before the library