Problem trapping event in a matrix SBO 2004

Hi
I am trying to trap when the lost focus event in a matrix, so if the cell is empty I want to put the focus back into that cell and call a formatted search
I can't seem to get the cursor to go back to the original cell. Can anyone help please ?
Regards Andy
    Case et_LOST_FOCUS:
    ' check if parish code is empty in posts matrix
    If pVal.formuid = "CONTACTS" And pVal.ItemUID = "228" And pVal.ColUID = "u_dpcode" And pVal.Before_Action = False Then
      Set oform = SBO_Application.Forms(formuid)
      Set omatrix = oform.Items("228").Specific
      If Trim(omatrix.Columns("u_dpcode").Cells(pVal.Row).Specific.String) = "" Then
        omatrix.Columns("u_dpcode").Cells.Item(pVal.Row).Click ct_Regular
        ' SBO_Application.SendKeys ("+{F2}")
      End If
      Set omatrix = Nothing
      Set oform = Nothing
    End If

Hi Paul,
Have you debuged the app and ensure if this line is executed?
omatrix.Columns("u_dpcode").Cells.Item(pVal.Row).Click ct_Regular
Which version is it?
in 2005, the Validate and Before_Action = true event is rised too, and you could use it to set the BubbleEvent to false(In 2004 it is not rised).
Regards,
Ibai Peñ

Similar Messages

  • I have problem to register add-ons to SBO 2004

    -. I am using sample HELLO WORLD providing for SDK 2004.
    -. I build the installer using packager default of Visual Basic 6.0.
    -. i builf file .ard
    -. when i register the add-on and restart SBO 2004, the system show the message error:
    "Command Line arguments..."
    Someone, have a procedure step by step to register add-ons to SBO?
    thanks

    You need to declare this functions from the SBOAddonReg.dll.
    I got this code from SAP, hope this works, it's VB .NET
    Also: To use the license key I go to Project/Project properties/Configuration properties/Command line arguments
    and I copy the license to this field, and it works.
    Did you try from command line something like this?
    c:\project.exe license_key
    2) Code for a useful application
    contact me, if you don't understand the example:
    [email protected]
    Option Strict Off
    Option Explicit On
    Friend Class Form1
         Inherits System.Windows.Forms.Form
    #Region "Windows Form Designer generated code "
         Public Sub New()
              MyBase.New()
              If m_vb6FormDefInstance Is Nothing Then
                   If m_InitializingDefInstance Then
                        m_vb6FormDefInstance = Me
                   Else
                        Try
                             'For the start-up form, the first instance created is the default instance.
                             If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
                                  m_vb6FormDefInstance = Me
                             End If
                        Catch
                        End Try
                   End If
              End If
              'This call is required by the Windows Form Designer.
              InitializeComponent()
         End Sub
         'Form overrides dispose to clean up the component list.
         Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
              If Disposing Then
                   If Not components Is Nothing Then
                        components.Dispose()
                   End If
              End If
              MyBase.Dispose(Disposing)
         End Sub
         'Required by the Windows Form Designer
         Private components As System.ComponentModel.IContainer
         Public ToolTip1 As System.Windows.Forms.ToolTip
         Public WithEvents CmdUnReg As System.Windows.Forms.Button
         Public WithEvents CmdReg As System.Windows.Forms.Button
         Public WithEvents CmdExit As System.Windows.Forms.Button
         Public WithEvents CmdAddOnStr As System.Windows.Forms.Button
         'NOTE: The following procedure is required by the Windows Form Designer
         'It can be modified using the Windows Form Designer.
         'Do not modify it using the code editor.
         <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Me.components = New System.ComponentModel.Container
            Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
            Me.CmdUnReg = New System.Windows.Forms.Button
            Me.CmdReg = New System.Windows.Forms.Button
            Me.CmdExit = New System.Windows.Forms.Button
            Me.CmdAddOnStr = New System.Windows.Forms.Button
            Me.SuspendLayout()
            'CmdUnReg
            Me.CmdUnReg.BackColor = System.Drawing.SystemColors.Control
            Me.CmdUnReg.Cursor = System.Windows.Forms.Cursors.Default
            Me.CmdUnReg.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            Me.CmdUnReg.ForeColor = System.Drawing.SystemColors.ControlText
            Me.CmdUnReg.Location = New System.Drawing.Point(24, 112)
            Me.CmdUnReg.Name = "CmdUnReg"
            Me.CmdUnReg.RightToLeft = System.Windows.Forms.RightToLeft.No
            Me.CmdUnReg.Size = New System.Drawing.Size(153, 25)
            Me.CmdUnReg.TabIndex = 3
            Me.CmdUnReg.Text = "UnRegister"
            'CmdReg
            Me.CmdReg.BackColor = System.Drawing.SystemColors.Control
            Me.CmdReg.Cursor = System.Windows.Forms.Cursors.Default
            Me.CmdReg.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            Me.CmdReg.ForeColor = System.Drawing.SystemColors.ControlText
            Me.CmdReg.Location = New System.Drawing.Point(24, 64)
            Me.CmdReg.Name = "CmdReg"
            Me.CmdReg.RightToLeft = System.Windows.Forms.RightToLeft.No
            Me.CmdReg.Size = New System.Drawing.Size(153, 25)
            Me.CmdReg.TabIndex = 2
            Me.CmdReg.Text = "Register"
            'CmdExit
            Me.CmdExit.BackColor = System.Drawing.SystemColors.Control
            Me.CmdExit.Cursor = System.Windows.Forms.Cursors.Default
            Me.CmdExit.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            Me.CmdExit.ForeColor = System.Drawing.SystemColors.ControlText
            Me.CmdExit.Location = New System.Drawing.Point(24, 160)
            Me.CmdExit.Name = "CmdExit"
            Me.CmdExit.RightToLeft = System.Windows.Forms.RightToLeft.No
            Me.CmdExit.Size = New System.Drawing.Size(153, 25)
            Me.CmdExit.TabIndex = 1
            Me.CmdExit.Text = "Exit"
            'CmdAddOnStr
            Me.CmdAddOnStr.BackColor = System.Drawing.SystemColors.Control
            Me.CmdAddOnStr.Cursor = System.Windows.Forms.Cursors.Default
            Me.CmdAddOnStr.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            Me.CmdAddOnStr.ForeColor = System.Drawing.SystemColors.ControlText
            Me.CmdAddOnStr.Location = New System.Drawing.Point(24, 16)
            Me.CmdAddOnStr.Name = "CmdAddOnStr"
            Me.CmdAddOnStr.RightToLeft = System.Windows.Forms.RightToLeft.No
            Me.CmdAddOnStr.Size = New System.Drawing.Size(153, 25)
            Me.CmdAddOnStr.TabIndex = 0
            Me.CmdAddOnStr.Text = "Create AddOn String As File"
            'Form1
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.BackColor = System.Drawing.SystemColors.Control
            Me.ClientSize = New System.Drawing.Size(202, 206)
            Me.Controls.Add(Me.CmdUnReg)
            Me.Controls.Add(Me.CmdReg)
            Me.Controls.Add(Me.CmdExit)
            Me.Controls.Add(Me.CmdAddOnStr)
            Me.Cursor = System.Windows.Forms.Cursors.Default
            Me.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            Me.Location = New System.Drawing.Point(4, 23)
            Me.Name = "Form1"
            Me.RightToLeft = System.Windows.Forms.RightToLeft.No
            Me.Text = "Form1"
            Me.ResumeLayout(False)
        End Sub
    #End Region
    #Region "Upgrade Support "
         Private Shared m_vb6FormDefInstance As Form1
         Private Shared m_InitializingDefInstance As Boolean
         Public Shared Property DefInstance() As Form1
              Get
                   If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
                        m_InitializingDefInstance = True
                        m_vb6FormDefInstance = New Form1()
                        m_InitializingDefInstance = False
                   End If
                   DefInstance = m_vb6FormDefInstance
              End Get
              Set
                   m_vb6FormDefInstance = Value
              End Set
         End Property
    #End Region
         'long GetInstallPath(const char *installDataFile,char *outStr,long len);
        Private Declare Function GetInstallPath Lib "SBOAddonReg.dll" (ByVal installDataFile As String, ByVal outStr As String, ByRef lLen As Integer) As Integer
         'BOOL RegisterAddOn(void);
        Private Declare Function RegisterAddOn Lib "SBOAddonReg.dll" () As Boolean
         'BOOL UnRegisterAddOn(const TCHAR *installDataFile);
        Private Declare Function UnRegisterAddOn Lib "SBOAddonReg.dll" (ByVal installDataFile As String) As Boolean
         Private g_sInstallPath As String
         Private g_sInstallFullPath As String
         Private g_sPreviousDir As String
         Private g_sAddOnExeName As String
         Private Sub CmdAddOnStr_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdAddOnStr.Click
              Shell(VB6.GetPath & "\AddOnRegDataGen.exe", AppWinStyle.NormalFocus)
              CmdReg.Enabled = True
         End Sub
         Private Sub CmdExit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdExit.Click
              End
         End Sub
         Private Sub CmdReg_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdReg.Click
              Dim sPath As String
              Dim lLen As Integer
              Dim InstallStrFile As String
              sPath = Space(1024)
              'Getting the sPath where I have to install the addon exe
            InstallStrFile = VB6.GetPath & "\SBOAddOnRegData.sld"
              lLen = GetInstallPath(InstallStrFile, sPath, Len(sPath))
              'Coping the addon exe into the path location I got
              MsgBox("Please copy your Addon exe file into: " & Trim(sPath))
              'Writing to the registry
              If RegisterAddOn = 1 Then
                   MsgBox("AddOn Was Registered Successfully")
                   CmdUnReg.Enabled = True
              Else
                   MsgBox("Failed To Register AddOn")
              End If
         End Sub
         Private Sub CmdUnReg_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdUnReg.Click
              Dim InstallStrFile As String
            InstallStrFile = VB6.GetPath & "\SBOAddOnRegData.sld"
              If UnRegisterAddOn(InstallStrFile) = 1 Then
                   MsgBox("AddOn Was UnRegistered Successfully")
              Else
                   MsgBox("Failed To UnRegister AddOn")
              End If
         End Sub
    End Class

  • Problem with a check box in SBO 2004

    Hi
    I have created a form in screen painter which is linked to a user defined object. All the text fields are being saved ok to the table.
    I have just added some check box's but there not working correctly. I can tick the box but not deselect it. It doesn't seem to be saving it either. It is bound to a single character field in the table.
    Does anyone have any ideas pls ?
    Regards Andy

    Hi Adele
    I just cracked it, if I add the fields in code it worked. I then went on to save the form in xml and compare it to my screenpainter code. Valoff and Valon are not set because they are not options in screenpainter.
    Agrees with what you said, what do you think ?
    Regards Andy

  • Problem with checkbox column in matrix

    Hello.
    I have a little problem with checkbox column in matrix.
    Column is binded to the UserData.
    It has ValOn="Y", ValOff="N".
    I use C++. It is wird problem. In matrix I have 10 columns - scrollbar role and if You want see checkbox column, You must role to the right. If this column is on the screen, and I use:
    checkcell->PutChecked(VARIANT_TRUE);
    then the checkbox is cheched, and if the checkbox isn`t on the screen and I use this comment - it nothing happening.
    I tried to use ValOn="Y", PutChecked...
    The problem i solved if the column is on the screen - if the column is first in matrix or second, but if it`s last I have a big problem.
    My column with checkbox is not editable, but I tried to make it editable, check it, and then make it uneditable - the same efect.
    How can I solve it ?
    Sorry for my english.
    Kamil Wydra

    Hello Kamil,
    I am not sure about your problem, but here is an example of how to use checkbox in UI API.
    First, create the matrix with checkbox column in Screen painter, and the output is an xml file, like this. Type as 121 indicates that it is a check box.
    - <column AffectsFormMode="0" backcolor="-1" description="" disp_desc="0" editable="0" right_just="0" title="Rented" type="121" uid="Rented" val_off="N" val_on="Y" visible="1" width="41">
      <databind alias="U_RENTED" databound="1" table="@VIDS" />
      <ExtendedObject />
    Second, bind the column to table from DB. This is a bug of 2004 Screen Painter, so if you are using 2005 Screen Painter, there is no problem.
    Third, when you open the form, you can check and uncheck the cell.
    BTW, please set the editable of the column to true.
    Hope this helps,
    Nick

  • Version incompatibility issue with Interop.SAPbobsCOM.dll in SBO 2004

    Hi,
    I have encountered an incompatibility issue in DI API 2004 across different patch level-versions. Originally, I developed an application in SBO 2004 pl4 environment. Now, some of the customers who were installing the application, notified me that the application has a login problem. It turned out that the CompanyClass.connect() method returns an error message "object reference not set to an instance of an object", when the DI API version installed in the production environment is higher (in this case, pl7) than the DI API version which was used in the development environment.
    I figured out that the problem can be fixed by replacing the Interop.SAPbobsCOM.dll file in the application directory by a newer version that reflects the DI API that is installed in the system. However, it seems a rather lousy workaround, if the customer needs to manually replace the dll. Maybe the installer could be customized to "sniff" the correct DI API level, but this too would be a pretty kludgy solution.
    Does anyone know a better solution to this problem ?
    Regards,
    Henry

    normally this is not a problem as long as they don't change the signatures on the DI-API (which they said they wouldn't) but it appears in P5 they changed that signature... we noticed some enums that got added and a few minor changes.

  • Right click event on a matrix

    Hi All
    I have to capture the right click event on a matrix
    here is my code
    <B1Listener(BoEventTypes.et_RIGHT_CLICK, True)> _
            Public Overridable Function OnBeforeRightClick(ByVal pVal As ContextMenuInfo) As Boolean
                Dim form As Form = B1Connections.theAppl.Forms.Item(pVal.FormUID)
                'ADD YOUR ACTION CODE HERE ...
                If pVal.ItemUID = "matItems" Then
                    ' do something
                End If
                Return True
            End Function
    the problem is that pVal.ItemUID always return null.
    Can any one help me
    Regards
    Arun TB
    Edited by: aruntb on Jul 14, 2010 9:39 PM

    Solved

  • SBO 2004

    Hi all:
    I have just recieved the version SBO 2004, and in reference of the UI, I want to know when they will be available the tree control and Hierarchical's tables, because I need this structure to  make a project.
    Thanksssssss

    Heard too, that B1 2004 supports ActiveX using B1 UI forms. How to use ActiveX component on a form ? Is it possible to host an ActiveX form on a B1 UI form ?
    The idea is, the component palatte from B1 is not that rich and the UI components (for example Matrix) are not that smart. We want to make an ActiveX form and place the whole ActiveX form on the UI form of B1. By this way, we still using B1 forms with their layout and keeping the MDI child order, instead of using a normal WinForm, which will be hidden from the B1 client, when activating it and loosing the Z-order of the MDI.

  • Rightclick and context menu functionality in SBO 2004

    hi guys...
    how to capture the right click event and the context menu event. I have seen the right click example in the SBO 2005 examples but how to get that functionality in SBO 2004, there r no SAPbouiCOM.ContextMenuInfo and SBO_Application.RightClickEvent
    thanx in advance..
    regards,
    Vasu..

    Hi,
    I don't think you can achieve this in the 2004 version as it was an entirely new feature in the 2005A SDK.
    Regards,
    Owen

  • SBO 2004 & Framework 2.0

    Hi,
    My environment of development is SBO 2004, and .net 2005.
    Any body knows if there are any problem working in this scenario?
    Thanks

    Hector,
    There are no problems that I am aware of.  Are you experiancing any?
    Eddy

  • Problem with event handling

    Hello all,
    I have a problem with event handling. I have two buttons in my GUI application with the same name.They are instance variables of two different objects of the same class and are put together in the one GUI.And their actionlisteners are registered with the same GUI. How can I differentiate between these two buttons?
    To be more eloborate here is a basic definition of my classes
    class SystemPanel{
             SystemPanel(FTP ftp){ app = ftp};
             FTP app;
             private JButton b = new JButton("ChgDir");
            b.addActionListener(app);
    class FTP extends JFrame implements ActionListener{
               SystemPanel rem = new SystemPanel(this);
               SystemPanel loc = new SystemPanel(this);
               FTP(){
                       add(rem);
                       add(loc);
                       pack();
                       show();
           void actionPerformed(ActionEvent evt){
            /*HOW WILL I BE ABLE TO KNOW WHICH BUTTON WAS PRESSED AS THEY
               BOTH HAVE SAME ID AND getSouce() ?
               In this case..it if was from rem or loc ?
    }  It would be really helpful if anyone could help me in this regard..
    Thanks
    Hari Vigensh

    Hi levi,
    Thankx..
    I solved the problem ..using same concept but in a different way..
    One thing i wanted to make clear is that the two buttons are in the SAME CLASS and i am forming 2 different objects of the SAME class and then putting them in a GUI.THERE IS NO b and C. there is just two instances of b which belong to the SAME CLASS..
    So the code
    private JButton b = new JButton("ChgDir");
    b.setActionCommand ("1");
    wont work as both the instances would have the label "ChgDir" and have setActionCommand set to 1!!!!
    Actually I have an array of buttons..So I solved the prob by writting a function caled setActionCmdRemote that would just set the action commands of one object of the class differently ..here is the code
    public void setActionCommandsRemote()
         for(int i = 0 ; i <cmdButtons.length ; i++)
         cmdButtons.setActionCommand((cmdButtons[i].getText())+"Rem");
    This just adds "rem" to the existing Actioncommand and i check it as folows in my actionperformed method
         if(button.getActionCommand().equals("DeleteRem") )          
                        deleteFileRemote();
          else if(button.getActionCommand().equals("Delete") )
                     deleteFileLocal();Anyway thanx a milion for your help..this was my first posting and I was glad to get a prompt reply!!!

  • Trapping Events such as Goods Reciept for Purchase Order

    Hi,
    I want to be able to trap events such as a Goods Reciept and respond to it.
    Because this can happen both in the goods reciept form or the AP Invoice Form or by automatic posting, is there a way to 'listen' for this event behind the scenes ?
    I also want to do it with reciepting production orders.
    Thanks
    Nick

    HI,
    USe SP_TRANSACTIONNITOFICATION for trapping events at SQL server SIDE.
    I am suggesting:
    1. Create your table
    2. Write a simple code in T-SQL into SP_TRANSACTIONNITOFICATION  which the monitored event inserts rows into your table
    3. Check the table from your addon and process the rows inside,
    Or use the following solution:
    Re: Stored Proc - BP Account On Hold
    It is hard, but working.
    Regards,
    J.

  • [JClient 9.0.3] Trapping events and canceling actions

    Subject: [JClient 9.0.3] Trapping events and canceling actions
    I'd like to be able to, based on some condition, abort certain
    actions (navigate, delete, insert, etc, etc) when the appropriate
    events have been fired.
    E.g., in case the Transaction is dirty and when I navigate to a
    certain row in a certain ViewObject instance, I would like to
    intercept this action and let the user decide what to do:
    Commit/Rollback/Cancel. Of cource when 'Cancel' is selected, the
    navigation-action should be aborted at all.
    I have realised this functionality by subclassing JUNavigationBar
    and either calling super's actionPerformed() or not. This works
    perfectly, but of course there are other means to navigate (a
    JComboBox + NavigationBinding, a JTable or programmatically), so
    I would need to implement similar functionality for each of these
    component types.
    So, what I need to do is to intercept these actions on a lower
    level. It appears that I need to register RowSetListeners to
    ViewObject instances, but as far as I can tell, this way there
    isn't a real way to abort these actions once they are started.
    Am I pherhaps overlooking something? Any help and/or suggestions
    would be greatly appreciated.
    Arno

    Subject: [JClient 9.0.3] Trapping events and canceling actions
    I'd like to be able to, based on some condition, abort certain
    actions (navigate, delete, insert, etc, etc) when the appropriate
    events have been fired.
    E.g., in case the Transaction is dirty and when I navigate to a
    certain row in a certain ViewObject instance, I would like to
    intercept this action and let the user decide what to do:
    Commit/Rollback/Cancel. Of cource when 'Cancel' is selected, the
    navigation-action should be aborted at all.
    I have realised this functionality by subclassing JUNavigationBar
    and either calling super's actionPerformed() or not. This works
    perfectly, but of course there are other means to navigate (a
    JComboBox + NavigationBinding, a JTable or programmatically), so
    I would need to implement similar functionality for each of these
    component types.
    So, what I need to do is to intercept these actions on a lower
    level. It appears that I need to register RowSetListeners to
    ViewObject instances, but as far as I can tell, this way there
    isn't a real way to abort these actions once they are started.
    Am I pherhaps overlooking something? Any help and/or suggestions
    would be greatly appreciated.Yes you're right in saying that there are many ways one could perform navigate - by other controls, by calling next() on the VO or even on the RowSetIterator. Also BC4J does not generate 'events' before navigation to preempt navigation unless a row is 'modified' in which case RowValidation events are generated for the Entities modified in that row.
    The most generic way you may fix this is by 'listening' to rowsetiterator's navigation events and get the PreviousRow from the navigation events and set focus back to it if user presses cancel, or get the current RowKey and let the user commit/rollback and then restore the currency to a row with that rowkey (just in case the MT is set to clear all caches on commit/rollback transaction boundaries). Note that insert/delete events should not be handled this way as those event points are usually generated due to a button action and it's easier to preempt these actions rather than 'let the actions' complete and then perform a rollback-to-a-particular-point.
    Arno

  • SBO 2004 and ActiveX

    I heard, that SBO 2004 now supports ActiveX at the UI API. Where can I find an ActiveX sample ? We want to use ActiveX forms, instead of only a control, by this way we will want to be able to use .Net components directly via a WinForm as ActiveX form in a SBO UI form.
    I have also read about .Net connectors. Are they available in SBO 2004 ?
    Greetz
    Kristian

    Here is a link in the forums "SAP Business ONE" where they talk about this:
    SBO 2004
    Perhaps posting your message there will give you a better response.
    Message was edited by: Craig Cmehil

  • Problems using event structure to write new parameter values to VISA

    Attachments:
    FMA_event_2.vi ‏28 KB
    FMA_event_2.vi ‏28 KB

    It seems I'm also having trouble using forums..not sure what happened...updated and corrected thread: http://forums.ni.com/t5/LabVIEW/Problems-using-event-structure-to-write-new-parameter-values-to/td-p...

  • Problems with events in flex

    Hi there. I'm a AS2 and Flash CS3 guy. I started to learn AS3 and transfer to Flex 3. But I got a problem w/ Events in AS3. I'm adding a canvas component to the stage. On that canvas, I added 3 different events: mouse down, mouse move, and mouse up. When mouse move is fired, there is no way for me to get mouse up event fired, and viceversa, when mouse up is fired, there is no way to get the mouse move event fired. Is there any one to help this newbie with this particular problem? Any help will be very appreciated.
    Code:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:canvas id="myCanvas" x="50" y="50" width="500" height="500" click="event_1();" mouseMove="event_2();" mouseUp="event_3();">
    </mx:Canvas>
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import flash.events.*;
    public function event_1():void
    { Alert.show("First event fired"); }
    public function event_2():void
    { Alert.show("Second event fired"); }
    public function event_3():void
    { Alert.show("third event fired); }
    </mx:Script>
    </mx:Application>

    Hi Greg. Thank you for your replay. The question is I didnt want to bother you with the complete code and post it with the minimal expression. But here I give you the full code w/corresponding package. What I'm trying to do is drawing a line over an empty canvas (I got it very easily in Flash AS2)
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="addChild(p1)">
    <mx:Canvas id="wrapper" x="10" y="10" width="600" height="600">
      <mx:Canvas x="50" y="50" width="500" height="500" id="imageView" backgroundColor="#F8F3F3" click="startDraw();" mouseMove="drawLine();" mouseUp="noDrawLine();" >
      </mx:Canvas>
    </mx:Canvas>
    <mx:Button x="263" y="618" label="Draw Line" click="prepToDraw();"/>
    <mx:Script>
    <![CDATA[
      import com.myDomain.Lines.Main;
       import mx.graphics.*;
       import mx.binding.utils.BindingUtils;
       import flash.events.IOErrorEvent;
       import flash.events.Event;
       import flash.display.*;
       import mx.controls.Alert;
       import com.myDomain.Lines.Main;
       public var p1:Main = new Main();
       public var pre:Number = 0;
       public function prepToDraw():void
        pre = 1;
       public function startDraw():void
        if(pre == 1)
        p1.graphics.clear();
        var newColor:int = 0xFF00FF;
        var iniX:Number = mouseX;
        var iniY:Number = mouseY;
        var lineWidth:Number = 10;
        p1.graphics.lineStyle(lineWidth, newColor);
        p1.graphics.moveTo(iniX, iniY);
       public function drawLine():void
        if(pre == 1)
         p1.graphics.lineTo(mouseX, mouseY);
       public function noDrawLine():void
        if(pre == 1)
         Alert.show("noLine");
    ]]>
    </mx:Script>
    </mx:Application>
    The package:
    package com.myDomain.Lines
    import flash.display.Shape;
    import flash.display.Stage;
    import flash.events.MouseEvent;
    import mx.core.UIComponent;
    public class Main extends UIComponent
      public function Main()
       super();
      public var p1:Shape = new Shape();
    If you go apply the code, you will see: 1) The first event to fire is mouseUp, then you eill start drawing the line, but again, you will not be able to stop this event with mouseUp. If you can help me, I will be very appreciated. Thanks. 

Maybe you are looking for