Delphi 7 - UI API Event pVal problem
Dear community,
I've setup the UI API in Delphi 7 by using the generated SAPbouiCOM_TLB, most seem to work but I have a blocking problem with the eventhandling of the UI API. The pVal parameters are not passed correctly back by the event and, when accesed, cause access violations.
There are some other threads about this problem.
There are two answers given:
1: Use another program then Delphi which is not an option for me.
2: Change the parameters to Olevariants. This is what I am trying to do.
I changed the class names in SAPbouiCOM_TLB to prevent naming problems
TApplicationItemEvent --> TSUI_ApplicationItemEvent
I changed my procedure declaration
from:
procedure SBO_Application_ItemEvent(ASender: TObject;
const FormUID: WideString;
var pVal: IItemEvent;
out BubbleEvent: WordBool) of object;
to:
procedure SBO_Application_ItemEvent(ASender: TObject;
const FormUID: OleVariant;
var pVal: OleVariant;
out BubbleEvent: OleVariant);
This has to be changed in SAPbouiCOM_TLB to so I did
from:
TSUI_ApplicationItemEvent = procedure(ASender: TObject; const FormUID: WideString;
var pVal: IItemEvent;
out BubbleEvent: WordBool) of object;
to:
TSUI_ApplicationItemEvent = procedure(ASender: TObject; const FormUID: OleVariant;
var pVal: OleVariant;
out BubbleEvent: OleVariant) of object;
Now the only thing there has to be done is changing the typecasting in TSUI_Application.InvokeEvent.
Here a TVariantArray is converted to the WideString, IItemEvent and WordBool.
And here is my problem. I don't know how to change this typecasting to OleVariants.
procedure TApplication.InvokeEvent(DispID: TDispID; var Params: TVariantArray);
begin
case DispID of
-1: Exit; // DISPID_UNKNOWN
100: if Assigned(FOnItemEvent) then
FOnItemEvent(Self,
Params[0] {const WideString},
IItemEvent((TVarData(Params[1]).VPointer)^) {var IItemEvent},
WordBool((TVarData(Params[2]).VPointer)^) {out WordBool});
How do I change IItemEvent((TVarData(Params[1]).VPointer)^) to the correct way?
Thanks in advance,
Sandra
Hi
I've got the Same Problem
Has Anyone Fixed this problem.. Running Delphi 7 with SAP SBO 8.81 with the UI
Similar Messages
-
This is just an FYI.
If you use the wizard to generate an exception rule for API events, sometimes the pattern created isn't correct. For example, you have an ASP.NET application that trips this event:
TESTMODE: The process 'C:\WINDOWS\system32\inetsrv\w3wp.exe' (as user NT AUTHORITY\NETWORK SERVICE) attempted to access a resource which would have resulted in the user being asked the following question. 'The process C:\WINDOWS\system32\inetsrv\w3wp.exe is attempting to invoke a system function from a buffer. Do you wish to allow this?'
And the wizard excludes this pattern:
f643001f7510897b0883c4145f5e5b*\CreateThread\**\CreateThread
You will need to remove the 2nd CreateThread at the end so it looks like this:
f643001f7510897b0883c4145f5e5b*\CreateThread\**
I don't know if this is a bug in the API rules themselves, or in the wizard itself. It only seems to be a problem when its duplicated - if it shows a destination file or another value, then it works fine as-is. Hope this helps someone.Also, when you took them out of test mode, did you move the host to a different group or are they in the same group just with test mode disabled?
You may want to check the group itself to see if the logging option is on. Check out screen shot -
What is Event queue problem?
HI,
I have come across JSF document, they mentioned that Event queue
Problem ins SUN's JSF implementation. what is that?You're going to have to be a little more specific.
-
GUI event handling problems appear in 1.4.1 vs. 1.3.1?
Hi,
Has anyone else experienced strange event handling problems when migrating from 1.3.1 to 1.4.1? My GUI applications that make use of Swing's AbstractTableModel suddenly don't track mouse and selection events quickly anymore. Formerly zippy tables are now very unresponsive to user interactions.
I've run the code through JProbe under both 1.3 and 1.4 and see no differences in the profiles, yet the 1.4.1 version is virtually unusable. I had hoped that JProbe would show me that some low-level event-handling related or drawing method was getting wailed on in 1.4, but that was not the case.
My only guess is that the existing installation of 1.3.1 is interfering with the 1.4.1 installation is some way. Any thoughts on that before I trash the 1.3.1 installation (which I'm slightly reluctant to do)?
My platform is Windows XP Pro on a 2GHz P4 with 1GB RAM.
Here's my test case:
import javax.swing.table.AbstractTableModel;
import javax.swing.*;
import java.awt.*;
public class VerySimpleTableModel extends AbstractTableModel
private int d_rows = 0;
private int d_cols = 0;
private String[][] d_data = null;
public VerySimpleTableModel(int rows,int cols)
System.err.println("Creating table of size [" + rows + "," + cols +
d_rows = rows;
d_cols = cols;
d_data = new String[d_rows][d_cols];
int r = 0;
while (r < d_rows){
int c = 0;
while (c < d_cols){
d_data[r][c] = new String("[" + r + "," + c + "]");
c++;
r++;
System.err.println("Done.");
public int getRowCount()
return d_rows;
public int getColumnCount()
return d_cols;
public Object getValueAt(int rowIndex, int columnIndex)
return d_data[rowIndex][columnIndex];
public static void main(String[] args)
System.err.println( "1.4..." );
JFrame window = new JFrame();
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
Dimension size = new Dimension(500,500);
panel.setMinimumSize(size);
panel.setMaximumSize(size);
JTable table = new JTable(new VerySimpleTableModel(40,5));
panel.add(table);
window.getContentPane().add(panel);
window.setSize(new Dimension(600,800));
window.validate();
window.setVisible(true);
Thanks in advance!!
- DeanHi,
I've fixed the problem by upgrading to 1.4.1_02. I was on 1.4.1_01.
I did further narrow down the symptoms more. It seemed the further the distance from the previous mouse click, the longer it would take for the table row to highlight. So, clicking on row 1, then 2, was much faster than clicking on row 1, then row 40.
If no one else has seen this problem -- good! I wouldn't wish the tremendous waste of time I've had on anyone!
- Dean -
Labview slider event handling problems - revisited
This topic asked a question that was very close to a problem I am having:
Labview slider event handling problems
That is, how do I, using an event structure and/or other means, only read out the value of a slider control after the value change is finalized?
The extra constraint I'd like to place on this, which I believe will invalidate the answer given in the thread above, is that my slider control also has a digital display which can also be used to change the value without ever using the mouse. I cannot look for a value change followed by a mouse-up event if the mouse was not used to change the value.
Any ideas how this might be accomplished? FWIW, I am using LabVIEW 7.0Each and every incremental value-change event generated by the movement of the slider is still detected and queued up for use by the event structure and the event structure loop wades through them all before it's done.
I have come up the attached "fix" (LV v7.0) for this problem. While it is not as clean a solution as I had hoped it would be, it's the best I can manage given what LabVIEW offers me to work with and it does work in the situation where I need to use it.
Now, within the Finalize Slider Events subVI, I'm keeping track of the most-recent values seen by the subVI, checking to see if they have changed, and reporting out that fact. That gives me a Changed/Not-Changed bit within the event case that I can use to control what code then gets executed. If the event case is just playing catch-up to the real value of the control, I can now see that fact and ignore it.
In this version I've also dumped the variant output and limited the VI to using DBL values. I decided it added complication to something that was too complicated already and I wanted the output terminals for other purposes anyway (reporting of the correct "OldVal" of the control).Message Edited by Warren Massey on 04-28-2005 03:56 AM
Attachments:
slider_events[5].llb 77 KB -
Delicate ProgressMonitor/ event handling problem
Hi,
I have a delicate ProgressMonitor / event handling problem.
There exists some solution on similiar problems here in the forums, but no solution to my special problem, hope anybody can help me out.
I have a rather big project, an applet, that I've written a separate JarLoader class that will load specific jar's if the ClassLoader encounter a unloaded class, all ok so far.
But, during loading, I would like to display a ProgressBar. And here is the problem. If my custom ClassLoader intercepts a findClass -request that needs to load the class from a jar from a normal thread, this is no problem, but if the ClassLoader intercepts a findClass that needs loading a jar when inside the EventQueue -thread, this is becomming tricky!
The catch is that an event posted on the EventQueue finally needs a class that needs to be loaded, but I cannot dispatch a thread to do this and end that particular event before the class itself is loaded.
So how do I hold the current EventQueue -event needing a jar -load, Pop up a ProgressBar, then process events in the EventQueue to display the ProgressBar and update repaints in it? then return from the event that now have loaded needed class-files.
I've tried a tip described earlier in the forums by trying to handle events with this code when loading the Jar:
/** process any waiting events - use during long operations
* to update UI */
static public void doEvents() {
// need to derive from EventQueue otherwise
// don't have access to protected method dispatchEvent()
class EvtQueue extends java.awt.EventQueue {
public void doEvents() {
Toolkit toolKit = Toolkit.getDefaultToolkit();
EventQueue evtQueue = toolKit.getSystemEventQueue();
// loop whilst there are events to process
while (evtQueue.peekEvent() != null) {
try {
// if there are then get the event
AWTEvent evt = evtQueue.getNextEvent();
// and dispatch it
super.dispatchEvent(evt);
catch (java.lang.InterruptedException e) {
// if we get an exception in getNextEvent()
// do nothing
// create an instance of our new class
EvtQueue evtQueue = new EvtQueue();
// and call the doEvents method to process the events.
evtQueue.doEvents();
}Then, the loader checks
java.awt.EventQueue.isDispatchThread()to see if its' inside the eventqueue, and runs doEvents after updating the ProgressMonitor with new setProgress and setNote values.
More precise;
The loader is loading the jar like this:
(this is pseudo code, not really usable, but outlines the vital parts)
public void load() {
monitor = new ProgressMonitor(null, "Loading " + jarName, ""+jarSize + " bytes", 0, jarSize);
monitor.setMillisToDecideToPopup(0);
monitor.setMillisToPopup(0);
// reading jar info code here ...
JarEntry zip = input.getNextJarEntry();
for (;zip != null;) {
// misc file handling here... total = current bytes read
monitor.setProgress(total);
monitor.setNote(note);
if (java.awt.EventQueue.isDispatchThread()) {
doEvents();
zip = input.getNextJarEntry();
monitor.close();
}When debugging doEvents(), there is never any events pending in peekEvents(), even if I tries to put a invokeLater() to run the setProgress on the monitor, why? If it had worked, the doEvents() code would have saved my day...
So, this is where I'm totally stuck...Just want to describe how I did this using spin from http://spin.sourceforge.net
This example is not pretty, but it can probably help others understanding spin. Cancelling the ProgressMonitor is not implemented, but can easily be done by checking on ProgressMonitor.isCanceled() in
the implementation code.
First, I create a bean for displaying and run a ProgressMonitor:
Spin requires an Interface and an Implementation, but that's just nice programming practice :-)
import java.util.*;
public interface ProgressMonitorBean {
public void start(); // start spinning
public void cancel(); // cancel
public int getProgress(); // get the current progress value
public void setProgress(int progress); // set progress value
public void addObserver(Observer observer); // observer on the progressValue
}Then, I created the implementation:
import java.util.*;
import javax.swing.ProgressMonitor;
import java.awt.*;
public class ProgressMonitorBeanImpl extends Observable implements ProgressMonitorBean {
private ProgressMonitor monitor;
private boolean cancelled;
private int progress = 0;
private int currentprogress = 0;
public ProgressMonitorBeanImpl(Component parent, Object message, String note, int min, int max) {
monitor = new ProgressMonitor(parent, message, note, min, max);
monitor.setMillisToDecideToPopup(0);
monitor.setMillisToPopup(0);
public void cancel() {
monitor.close();
public void start() {
cancelled = false;
progress = 0;
currentprogress = 0;
while (progress < m_cMonitor.getMaximum()) {
try {
synchronized (this) {
wait(50); // Spinning with 50 ms delay
if (progress != currentprogress) { // change only when different from previous value
setChanged();
notifyObservers(new Integer(progress));
monitor.setProgress(progress);
currentprogress = progress;
} catch (InterruptedException ex) {
// ignore
if (cancelled) {
break;
public int getProgress() {
return progress;
public void setProgress(int progress) {
this.progress = progress;
}in my class/jarloader code, something like this is done:
public void load() {
ProgressMonitorBean monitor = (ProgressMonitorBean)Spin.off(new ProgressMonitorBeanImpl(null, "Loading " + url,"", 0, jarSize));
Thread t = new Thread() {
public void run() {
JarEntry zip = input.getNextJarEntry();
for (;zip != null;) {
// misc file handling here... progress = current bytes read
monitor.setProgress(progress);
t.start(); // fire off loadin into own thread to do time consuming work
monitor.start(); // this will spin events on monitor and block until progress = max
monitor.cancel(); // Just make sure ProgressMonitor is closed
}The beautiful thing here is that Spin is taking care of weither the load() is inside the dispatch thread or not, making the code much simpler and cleaner to understand.
The ProgressMonitorBeanImplementation could been made much nicer and more complete, but I was in a hurry to check if it worked out. And it did! This will be applied on a lot of gui -components that blocks the event-queue in our project, making it much more responsive.
Hope this will help others in similiar situations! Thanks again svenmeier for pointing me to the spin -project. -
Hello everyone.
i am trying to handle events in the item master date form (150) in order to hide the Item Cost. It is working fine with most of the time using only the UI api. However if doing the following actions, the events are not processed by the application anymore.
1- Start SBO (2005 sp1 pl18)
2- Login
3- Start my add-on with vb.net
4- Go into the item master data.. (handling events correctly)
5- Close item master data.
6 -Go into another form
7- Close the other form
8- Go back into item master data --> no events handling is done
Any ideas???
Thank you
Simon
Source code.
Public Class ItemCostControl
Private WithEvents SBO_Application As SAPbouiCOM.Application
' Declare Event Filter
Public oFilters As SAPbouiCOM.EventFilters
Public oFilter As SAPbouiCOM.EventFilter
Private Const itemCostField As String = "64"
Private Const itemCostColumn As String = "22"
Private Const itemCostGrid As String = "28"
Private Const formItemMaster As String = "150"
Private Sub SetApplication()
'// Use an SboGuiApi object to establish the connection
'// with the application and return an initialized appliction object
Dim SboGuiApi As SAPbouiCOM.SboGuiApi
Dim sConnectionString As String
SboGuiApi = New SAPbouiCOM.SboGuiApi
sConnectionString = Environment.GetCommandLineArgs.GetValue(1)
'// connect to a running SBO Application
SboGuiApi.Connect(sConnectionString)
'// get an initialized application object
SBO_Application = SboGuiApi.GetApplication()
End Sub
Private Sub SetFilters()
'// Create a new EventFilters object
oFilters = New SAPbouiCOM.EventFilters
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_MENU_CLICK)
'// assign the form type on which the event would be processed
oFilter.AddEx("150")
SBO_Application.SetFilter(oFilters)
End Sub
Public Sub New()
'// set SBO_Application with an initialized application object
SetApplication()
'// set SBO_Application with an initialized EventFilters object
SetFilters()
End Sub
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Dim oForm As SAPbouiCOM.Form
System.Diagnostics.Debug.WriteLine("Item Event for " + FormUID)
If pVal.FormType <> 0 And pVal.BeforeAction = False Then
Select Case pVal.EventType
Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
System.Diagnostics.Debug.WriteLine("Item Pressed")
hideField(pVal.FormType, pVal.FormTypeCount, itemCostField)
hideColumn(pVal.FormType, pVal.FormTypeCount, itemCostGrid)
Case SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE
System.Diagnostics.Debug.WriteLine("Form Activate")
hideField(pVal.FormType, pVal.FormTypeCount, itemCostField)
hideColumn(pVal.FormType, pVal.FormTypeCount, itemCostGrid)
Case SAPbouiCOM.BoEventTypes.et_FORM_LOAD
System.Diagnostics.Debug.WriteLine("Form Load")
hideField(pVal.FormType, pVal.FormTypeCount, itemCostField)
hideColumn(pVal.FormType, pVal.FormTypeCount, itemCostGrid)
End Select
End If
End Sub
Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
'// in order to activate your own forms instead of SAP Business One system forms
'// process the menu event by your self
'// change BubbleEvent to True so that SAP Business One won't process it
Dim oForm As SAPbouiCOM.Form
If pVal.BeforeAction = False Then
hideField(formItemMaster, 1, itemCostField)
hideColumn(formItemMaster, 1, itemCostGrid)
End If
End Sub
Public Sub hideField(ByVal FormType As String, ByVal FormTypeCount As Integer, ByVal fieldNo As String)
Dim oForm As SAPbouiCOM.Form
oForm = SBO_Application.Forms.GetForm(FormType, FormTypeCount)
oForm.Items.Item(fieldNo).Left = 3000
oForm.Items.Item(fieldNo).Visible = False
End Sub
Public Sub hideColumn(ByVal FormType As String, ByVal FormTypeCount As Integer, ByVal fieldNo As String)
Dim oForm As SAPbouiCOM.Form
Dim oGrid As SAPbouiCOM.Matrix
Dim oItem As SAPbouiCOM.Item
oForm = SBO_Application.Forms.GetForm(FormType, FormTypeCount)
oItem = oForm.Items.Item(fieldNo)
oGrid = oItem.Specific
If oGrid.Columns.Item(itemCostColumn).Visible = True Then
oGrid.Columns.Item(itemCostColumn).Visible = False
oGrid.Columns.Item(itemCostColumn).Width = 0
End If
End Sub
End ClassHi, Simon!
Try setting filters like that:
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE)
'// assign the form type on which the event would be processed
oFilter.AddEx("150")
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
'// assign the form type on which the event would be processed
oFilter.AddEx("150")
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_MENU_CLICK)
'// assign the form type on which the event would be processed
oFilter.AddEx("150")
I suppose that the setting method you used, was filtering only et_MENU_CLICK for the 150-form. But other events (et_FORM_ACTIVATE, et_ITEM_PRESSED) were handling for all forms...
hth,
Aleksey -
Validate event performance problem
Dear all,
My problem is B1 run with my addon when copy from purchase order (with a lot of items) to good receipt PO spend a lot of time.
I tested with 2 cases as follows:
case 1: add filter to 143
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_VALIDATE)
oFilter.AddEx("143")
case 2: no filter to 143
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_VALIDATE)
'no filter to 143 oFilter.AddEx("143")
case 1 time used is 26s, case 2 time used is 10s.
I have commented my code with validate event but still spend a lot of times to load. It seems a lot of system validate event go into addon and cause performance issue. but I need to check if some value change and then update value and so which other event I can used to replace validate event?
Regards,
DavidDear Eric,
B1 version: 8.82(8.82.075) PL 11
In my addon we need to do 2 things:
1. Update sum of Quantity in matrix on screen:
If pVal.ItemUID = "38" Then
If pVal.InnerEvent = False Then
Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount)
If (pVal.ColUID = "U_Itm_Desc" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_VALIDATE And pVal.ItemChanged = True) Or _
(pVal.ColUID = "11" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_VALIDATE And pVal.ItemChanged = True) Then
Dim mat As SAPbouiCOM.Matrix = oForm.Items.Item("38").Specific
Dim sum As Integer = 0
If mat.VisualRowCount > 0 Then
For i As Integer = 1 To mat.VisualRowCount
Dim curQty As Integer = CInt(mat.Columns.Item("11").Cells.Item(i).Specific.value)
sum = sum + curQty
Next
oForm.DataSources.UserDataSources.Item("dsQty").ValueEx = sum
Else
oForm.DataSources.UserDataSources.Item("dsQty").ValueEx = 0
End If
End If
End If
End If
2. set due date = posting date if posting date is changed
If (pVal.ItemUID = "10" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_VALIDATE And pVal.ItemChanged = True) Then
Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount)
If oForm.Mode <> SAPbouiCOM.BoFormMode.fm_FIND_MODE And oForm.Items.Item("12").Specific.value <> oForm.Items.Item("10").Specific.value Then
oForm.Items.Item("12").Specific.value = oForm.Items.Item("10").Specific.value
End If
End If
Regards,
David -
Appraisals & training and event management problem
Hi gurus.
I'm trying to configured the integration between Appraisal and Training & Event management (Appraising a Business Event and Attendee Appraisal
I set an attribute HAP00 REPLA = A .
But two problems occurred.
1.
The definition of Appraisal catalog for employees is no problem. But I have a problem with definition of Appraisal catalog for Business event and for Attendees.
Through the definition of Appraisal catalog via SPRO (Training and Event Management/Recurring Activities/Appraisals/Edit Appraisals Catalog) its possible to create an appraisal templates only for employees (it looks like that, because there is only Category group Personnel Appraisals and its not possible to add new category for example Attendee Appraisal).
Can somebody help me where I can define appraisal templates for Event management or how can I get the Appraisal catalog category groups - Appraising a Business Event and Attendee Appraisal?
2.
I set the attributes SEMIN EVAEV/EVAPA to the values 2/3 in connection with table T77BF.
When I run tcode PV33 or PV34 the matchcode of appraisal templates contains the list of all object type VA. The problem is that when I run tcode PV33 I dont want to see all appraisal templates, but only for appraising a Business Event.
It is possible to configure that so? If yes, how.
Thanks in advance.
RegardsHi,
1. transaction LSO_CATALOG
Regards and Groetjes,
Maurice Hagen -
Weird event display problem in week view
Hi. I'm getting a weird display problem in week view. First time this has ever happened.
Some events appear to be missing, but when i double click on where I know the event is supposed to be, a new event is created (as excepted), and the missing events suddenly appear. When i move forward or back by a week, and then return to the week in question, the missing events are gone again. But, I can see the missing events in day view or month view.
Any ideas?Dean,
Next, try reinstalling the Mac OS X v10.6.2 Update (Combo).
If that is unsuccessful:
1. Use iCal>Export...>for each one of your individual calendars.
2. Delete all but one of your calendars.
3. Create a calendar and name it "Test."
4. Delete the calendar which remained after step #2.
5. Quit iCal.
6. Remove the iCal plist, and drag the iCal plist file to your Desktop.
7. Log out/in or restart.
8. Restart iCal and use iCal>File>Import...for each one of the calendars that you exported in step #1.
9. Delete the "Test" calendar, and any "Home/Work" calendar which was automatically created when you opened iCal in step #8.
;~) -
BSP extension "download" - event handling problem
Folks,
First of all, I apologize if the answer is already out there, but I spent quite some time to find the solution for my problem but finally gave up:
I implemented the Download extension from Brian's and Tom's book. Since I am using an MVC based app, I put the event handling in the DO_HANDLE_EVENT of a controller instead of the OnInputProcessing event of a page. Here's how my app is designed:
I have a main controller that has an execute button to trigger a data selection based on some selection criteria. The result of this selection is displayed by means of a subcontroller with tableviews that are wrapped into my zdownload extension. Everything works fine: I make my selections, execute the app through the button of the main controller and get my result shown in the tableviews. I push the download icon, select my file format (XLS, HTML etc), get the dialog to choose whether to download or to display the file, perfect!
But now after I processed the download successfully - if I click the execute button in the main controller again, I still get the download dialog. It looks like the created event for the download does not get cleared. As I mentioned, I searched through SDN, but all I found were referrals to the call of DISPATCH_INPUT( ) in DO_REQUEST of the main controller, but unfortunately this one is already implemented.
Any ideas?
Thanks,
GuentherThere is an attribute of the download extension called display_url. You pass a value to the extension telling it what cached URL contains the binary content for your download. if this display_url attribute has a value assigned to it, then the element will render an iFrame to call the URl. However if the display_url attribute is empty, it won't render the iFrame. I suspect that you have a stateful application and after your download event you aren't clearing whatever field that you pass into the display_url attribute.
-
Hi,
I'm having problems with a event handler that I'm trying to create.
I currently have 2 event handlers, one of which needs to only happen when Shift + a key is pressed. I currently have:
function keypressedHandler(event:KeyboardEvent):void { if ((event.shiftKey) + (event.keyCode == 81)) { //something would happen } }
So my question is how can I get the shift function to work? It doesn't matter if it isn't shift but Alt or Ctrl would be the alternatives.
Any help would be great,
Thanks,You need the ampersand (&) instead of the plus sign to use the logical AND:
stage.addEventListener( KeyboardEvent.KEY_DOWN, keypressedHandler )
function keypressedHandler(event:KeyboardEvent):void
if ((event.shiftKey) && (event.keyCode == 65))
//something would happen
trace( "shift and 65" ) -
[CS3][JS] beforeClose event listener problem
Hi all,
I want my script to do the following: every time when a user closes a document, I wish for "Check Spelling..." dialog box to show up and after the user finishes spell-checking, the document should be closed.
But instead, if I have one document open, I get an error: Error Number: 53762, Error String: Action is not enabled, and if more than one document open, the dialog opens in the wrong document.
As far as I understand, the problem is that the menu action is invoked AFTER the document has already been closed – it is quite clear that opening the dialog with no documents open makes no sense – that’s why the error occurs.
Does anybody know how to solve this? Why beforeClose event type doesn’t correspond to its name? The scripting guide states: “beforeClose – Appears after a close-document request is made but before the document is closed.”
Here is the script:
#targetengine "session"
main();
function main(){
var myEventListener = app.addEventListener("beforeClose", myCheckSpelling, false);
function myCheckSpelling(myEvent){
app.menuActions.item("Check Spelling...").invoke();
KasyanThank you Ole.
I've been at it for about 6 months.
I am providing 3 modules. All modules are in 1 folder. That's why the ScriptPath & Department variables.
FYI: app.pdfPlacePreferences.pageNumber was used solved issues with InEvenScript plugin for CS2. That plugin was NOT handling a loop call. To solve it, I've used a variable to turn ON & OFF the handler. "Import" is used in the OPEN script, and that will execute the event!
1) Startup. I trimmed it for you but I kept the orignal OPEN-Event disabled. See PrePressEVENT.
2) PrePressTEST. It's a trimmed version of the actual PrePressOPEN. But it makes InDesign crash. FYI: PrePressOPEN works perfectly when triggered manualy (Script Panel).
3) PrepressEVENT. Disabled in Startup, I am using this one so I can debug the EVENT and do actual work at the same time. Until it crashed of course.
The window.add() is what makes it crash. Without it, fine. But if removed myDoc = app.activeDocument points to the wrong one!
Thank you in advance. Hope this is clear enough.
Module STARTUP
=====================
#target indesign
#targetengine "session"
app.scriptPreferences.version = 5.0;
//******************** BEGIN Main ********************
var myScriptName = app.activeScript.fsName;
var myScriptPath = app.activeScript.path;
var myErrorStyle = "*****Error while Updating!"
var myMsgStyle = "*****No UpDate! (Delete to Reset)";
var myDept = "PrePress";
//*** Initialize SCRIPT Variables
app.scriptArgs.clear();
app.scriptArgs.set("Department", "PrePress");
app.scriptArgs.set("ErrorStyle", "*****Error while Updating!");
app.scriptArgs.set("MsgStyle", "*****No UpDate! (Delete to Reset)");
app.scriptArgs.set("Event_Path", myScriptPath); //***Path to InEventScript Plug-In
app.scriptArgs.set("Event_Test", myScriptPath + "/"+myDept+"TEST.jsx"); //*** Debugging MODULE
app.scriptArgs.set("Event_Open", myScriptPath + "/"+myDept+"OPEN.jsx");
app.scriptArgs.set("Event_Close", myScriptPath + "/"+myDept+"CLOSE.jsx");
app.scriptArgs.set("Event_Copy", myScriptPath + "/"+myDept+"COPY.jsx");
app.scriptArgs.set("Event_Clean", myScriptPath + "/"+myDept+"CLEAN.jsx");
app.scriptArgs.set("Event_Print", myScriptPath + "/"+myDept+"PRINT.jsx");
app.scriptArgs.set("Event_App", myScriptPath + "/"+myDept+"APPPreferences.jsx");
app.scriptArgs.set("Event_Doc", myScriptPath + "/"+myDept+"DOCPreferences.jsx");
//*** Initialize GLOBAL Variables
app.pdfPlacePreferences.pageNumber = 1; //***Flag to PREVENT InEventScript Plug-In RECURSIVE (Loop)
SkipWRDS = new Array;
//*** REMOVE all EVENTS
app.eventListeners.everyItem().remove();
//******************** EVENTS ********************
//app.addEventListener("afterOpen", EventOpen, false); //STILL INDESIGN CRASH with OPEN !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
var tmp = "List of Events loaded\n----------------------\n";
var myEvents = app.eventListeners;
for (var cpt = 0; cpt < myEvents.length; cpt++)
tmp += "Event : " + myEvents[cpt].parent.name + "\tType: " + myEvents[cpt].eventType + "\n";
//alert ("\tPREPRESS Area\n\t\==========\n\n"+tmp);
alert ("\tTEST Area\n\t=======\n\n"+tmp);
//******************** END Main ********************
//****************** FUNCTIONS Definitions ********************
function EventOpen (itsEvent)
var myExeSrcFile = new File (app.scriptArgs.get("Event_Open"));
if (myExeSrcFile.exists)
if (app.pdfPlacePreferences.pageNumber == 99999)
app.pdfPlacePreferences.pageNumber = 1; //***Flag to PREVENT InEventScript Plug-In RECURSIVE (Loop)
else
app.pdfPlacePreferences.pageNumber = 1; //***Flag to PREVENT InEventScript Plug-In RECURSIVE (Loop)
// itsEvent.preventDefault();
// itsEvent.stopPropagation();
itsEvent.parent.windows.add(); //*** Doc. has no Window!!!
myExeSrcFile.open ('r:(read)');
app.doScript(myExeSrcFile, ScriptLanguage.javascript);
myExeSrcFile.close();
else
alert ("Error! Missing File:\n\n" + myExeSrcFile.fsName);
return;
Module PrePressTEST
=====================
#target indesign
//#include "PrePressLIBRARY.jsxinc"
app.scriptPreferences.version = 5.0;
//******************** BEGIN Main ********************
if (app.modalState) //*** Alert already displayed
exit();
if (app.pdfPlacePreferences.pageNumber == 99999)
app.pdfPlacePreferences.pageNumber = 1; //***Flag to PREVENT InEventScript Plug-In RECURSIVE (Loop)
exit();
if (app.documents.length == 0)
exit();
var myDoc = app.activeDocument;
//*** ALL DOCUMENTS PREFERENCE
myDoc.textPreferences.showInvisibles = true;
myDoc.viewPreferences.showRulers = true;
myDoc.layoutWindows[0].transformReferencePoint = AnchorPoint.centerAnchor;
alert (myDoc.name);
//******************** END Main ********************
Module PrePressEVENT
=====================
#target indesign
#targetengine "session"
app.scriptPreferences.version = 5.0;
//******************** BEGIN Main ********************
var myEvents = app.eventListeners;
var tmp = "\nList of Events removed\n------------------------\n";
for (var cpt = myEvents.length-1 ; cpt >= 0 ; cpt--)
if (myEvents[cpt].eventType == "afterOpen")
tmp += "Event #" + cpt + "\tType: " + myEvents[cpt].eventType + "\n";
myEvents[cpt].remove(); //*** There MAY be MORE than 1 instance.
//******************** EVENTS ********************
app.addEventListener("afterOpen", EventOpen, false);
tmp += "\nList of Events loaded\n----------------------\n";
var myEvents = app.eventListeners;
for (var cpt = 0; cpt < myEvents.length; cpt++)
tmp += "Event : " + myEvents[cpt].parent.name + "\tType: " + myEvents[cpt].eventType + "\n";
alert ("\tTEST Area\n\t=======\n\n"+tmp);
//******************** END Main ********************
//****************** FUNCTIONS Definitions ********************
function EventOpen (itsEvent)
// app.scriptArgs.set("Event_Listener", itsEvent.parent.toSource()); //*** PASS Argument
var myExeSrcFile = new File (app.scriptArgs.get("Event_Test"));
if (myExeSrcFile.exists)
if (app.pdfPlacePreferences.pageNumber == 99999)
app.pdfPlacePreferences.pageNumber = 1; //***Flag to PREVENT InEventScript Plug-In RECURSIVE (Loop)
else
app.pdfPlacePreferences.pageNumber = 1; //***Flag to PREVENT InEventScript Plug-In RECURSIVE (Loop)
EventInfo (itsEvent);
itsEvent.preventDefault();
itsEvent.stopPropagation();
itsEvent.parent.windows.add(); //*** Doc. has no Window!!!
myExeSrcFile.open ('r:(read)');
app.doScript(myExeSrcFile, ScriptLanguage.javascript);
myExeSrcFile.close();
alert ("Executed...");
else
alert ("Error! Missing File:\n\n" + myExeSrcFile.fsName);
return;
function EventInfo (itsEvent)
var myString = "Handling Event: " +itsEvent.eventType;
myString += "\r\rTarget: " + itsEvent.target + " " +itsEvent.target.name;
myString += "\rCurrent: " +itsEvent.currentTarget + " " + itsEvent.currentTarget.name;
myString += "\r\rPhase: " + GetPhaseName(itsEvent.eventPhase );
myString += "\rCaptures: " +itsEvent.captures;
myString += "\rBubbles: " + itsEvent.bubbles;
myString += "\r\rCancelable: " +itsEvent.cancelable;
myString += "\rStopped: " +itsEvent.propagationStopped;
myString += "\rCanceled: " +itsEvent.defaultPrevented;
myString += "\r\rTime: " +itsEvent.timeStamp;
alert(myString);
function GetPhaseName(myPhase)
switch(myPhase){
case EventPhases.atTarget:
myPhaseName = "At Target";
break;
case EventPhases.bubblingPhase:
myPhaseName = "Bubbling";
break;
case EventPhases.capturingPhase:
myPhaseName = "Capturing";
break;
case EventPhases.done:
myPhaseName = "Done";
break;
case EventPhases.notDispatching:
myPhaseName = "Not Dispatching";
break;
return myPhaseName; -
Calendar Event Invitiation problem
In Outlook Calendar (pre-ICloud), I could generate an event, then invite people to the meeting. Since I have several email accounts in my Outlook, I can choose which email address I want the invite sent from. Simple.
With the ICloud calendar, I do not see the drop down box which allows me to pick the email box to send from. This is a huge problem for me as I run several businesses and need to invite folks from the different email addresses I have. How can I continue to send events from different email addresses and keep using ICloud?You can't, invitations from iCloud will show the iCloud mail address.
-
Calendar Event Modification Problem with 2.2
I don't seem to be able to modify a calendar event like I was able to with 2.1. When I select the event from the calendar it briefly flashes a screen (which happens so fast I can't really read it) and then dumps me into a screen that I can't open the event from. Anyone else out there having a similar problem?
johnpa wrote:
I don't seem to be able to modify a calendar event like I was able to with 2.1. When I select the event from the calendar it briefly flashes a screen (which happens so fast I can't really read it) and then dumps me into a screen that I can't open the event from. Anyone else out there having a similar problem?
the screen should say that you don't have any calendars. i had this problem after my update. it wiped all of my saved events. i think with 2.1 you could use a google calendar AND/OR a phone calendar and with 2.2 it looks like you can only use google calendars.
anyway, if it's there, select your google calendar and you can start adding events to it. it's a PITA to have to re-enter everything tho.
Maybe you are looking for
-
I cannot get Safari to display PDF files, it shows a blank screen with the comment that Safri has blocked PDF, however when you unblock it still does not show the PDF, I have had to rely on Firefox for this, which I find not too good. Any help very m
-
IMac network issues... Please Help!
I have been running mavericks for quite a while now but just recently I have noticed that I am having issues with my internet connection. It started happening after I moved into my new apartment and signed up with a new internet provider. I will h
-
My iTunes wont sync files to my iPhone 4
Even if I delete something from my iTunes library it stays on my phone. I've restored my phone, reinstalled iTunes, checked everything for sync. It says sync is complete but nothing happens. Any ideas how to fix?
-
Alternate layout created when moving pages from one document to another
I'm using CC on Windows 7 - I have 2 documents that I want to merge and make into 1 [I know people will want to know why I would want to do this - each document is the result of a different data merge - data merge can only handle one master page
-
How does OOB breadcrumbs work for multisite environment
Hi I am currently using CatalogNavHistory and CatalogNavHistoryCollector to display breadcrumbs in my catalog pages. My doubt is with ATG10.1 we are using multisite environment for our project. So one category will be part of more than one site. So h