OnClicked Event on Block View.

Started by copter, June 16, 2009, 03:32:52 AM

Previous topic - Next topic

copter

Hello
In the attached example, the onclicked event is fired on a block view without clicking on the block view.
It seems that selecting an entity before loading the form is "stored" and then, sent as an event.
How can I prevent this behaviour ?
Attached files: Test.lsp - Test.odcl
Thanks
Copter

stephan_35

Hello,

It seems to me it is not possible to access the AutoCAD graphical box with a modal.

You must use a box modless!

In addition, it is preferable to initialize all the controls with the event "oninitialize.

Attached the example running.

working with 5.1.1.6

Best regards
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

copter

Hi Stephan,
I should not want use a modeless form...
I think that is likely a bug: If the clicked point, before loading the form, is out of the area of the next display of the control, it works.
If it is in the area, the onclick event is fired. (I tried with 5.1.1.4.)
Copter

Fred Tomke

Hm, quite interesting. Please add a textbutton and make sure that the blockview isn't the first control in the z/tab-order list.
Then this event won't be fired. This also happens to other controls (like textboxes or tab controls) when they are created during show-method.

If such a control is the only control in the form or must be the first in the z/tab-order list then you can avoid it by a variable. I do so with tab controls. But it doesn't work in this case. I would add it as a bug report.

Code (autolisp) Select

(defun c:test (/ isInit)
  (setq el (entsel "Select an entity >"))
  (dcl_project_load "Test" T)
  (setq isInit T)
  (dcl_form_show Test_Form1)
  (princ)
)

(defun c:Test_Form1_OnInitialize (/)
  (setq isInit nil)
)

(defun c:Test_Form1_BlockView1_OnClicked (/)
  (if (not isInit) (dcl_MessageBox "You did click on me !"))
)


Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

copter

Hi Fred

I tried to add a textbutton and others controls without any effect. :(

To Stephan:
You say: "In addition, it is preferable to initialize all the controls with the event "oninitialize."
Could you explain ? Is it preferable for the memory for example ?  Are there any rules for this ?
Because I am working on a big project, I will have to load maybe more than 100 (c:...) call back functions...

Copter

stephan_35

Good evening,

I also work on a big project,
In fact use "OnInitialize" to activate all functions effectively if the dialog was open properly.

Care of all your functions precompiled in a 'fas' file you can save memory, you lose, however, access time (negligible).

It must surely exist some part-specific rules allowing to maximize the memory, unfortunately, I do not know!


Also uses the "OnClose" which will destroy all the functions previously created by making 'nil'


Best regards
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

owenwengerd

Quote from: copter on June 16, 2009, 07:29:58 AM
I think that is likely a bug: If the clicked point, before loading the form, is out of the area of the next display of the control, it works.
If it is in the area, the onclick event is fired. (I tried with 5.1.1.4.)

I'm not sure that this is entirely a bug. The OnClicked event fires when you *release* the mouse button, and in this case, the form is displayed when you *press* the button. This means that the form is open by the time the mouse button is released, which triggers OnClicked. I will investigate to see if there is a workable solution.
Owen Wengerd (Outside The Box) / ManuSoft

owenwengerd

This should now be fixed for Beta 7.  I added logic to skip the OnClicked event if the button was not pressed down on the control before it was released.
Owen Wengerd (Outside The Box) / ManuSoft

Kerry


thanks Owen, you da bomb !   :)
Perfection is not optional.
My other home is TheSwamp


velasquez

I have the same problem with a PictureBox in a screen of Splash. 
See in the image that the property Enabled this defined as false. 
But if the user clicks on the image the the form that didn't still appear it recognizes the event of OnClicked.
 
I posted the links for two videos showing this.

http://www.4shared.com/file/112645609/f1fdd41d/Splash-NotClick.html
http://www.4shared.com/file/112647892/177a535d/SplashWithClick.html]
[url]http://www.4shared.com/file/112647892/177a535d/SplashWithClick.html
[/url]


copter

I also tried the enabled property to false, but the event onclick no more fires.
Copter

owenwengerd

Quote from: velasquez on June 18, 2009, 06:58:05 AM
But if the user clicks on the image the the form that didn't still appear it recognizes the event of OnClicked.

Can you post some simple sample code that demonstrates the problem?
Owen Wengerd (Outside The Box) / ManuSoft

velasquez

Hello Owen 
This problem this inside of a very big project. 
It is very difficult for me to separate this now. 
As soon as is possible I send for you. 
I made a list of steps below. 
1 - while SplashForm is presented I click with the mouse in the marked area. 
2 - first Form is called and it receives the event of last OnClicked for the splash form. 
3 - the second form is called. 
Below this the code that controls SplashForm.
Code (autolisp) Select

;;;This function controls exhibition of SplashForm
(defun JoyDelaySplash (/ wait)
;;;Wait function
  (defun wait (seconds / stop)
    (setq stop (+ (getvar "DATE") (/ seconds 86400.0)))
    (while (> stop (getvar "DATE")))
  ) ;_ fim de defun   
;;;Show SplashForm
  (dcl_Form_Show DuctilCAD_SplashForm)
;;;Time of wait
  (wait 2)
;;;Close SplashForm
  (dcl_Form_Close DuctilCAD_SplashForm)
;;;
  (setq JoyTagSplash T
JoyNextDlg 1
  ) ;_ fim de setq
  (vl-propagate 'JoyTagSplash)
  (princ)
) ;_ fim de defun
;;; -------------------------------------------------------------------------------------------------------------------
;;;Só executa Inicializacao do quadro Splash se precisar
   (if (not JoyTagSplash)
     (defun c:DuctilCAD_SplashForm_OnInitialize (/)
;;;Centraliza o quadro
       (dcl_Form_Center DuctilCAD_SplashForm)
     ) ;_ fim de defun
   ) ;_ fim de if
;;; -------------------------------------------------------------------------------------------------------------------
;;;LOOP
  (setq JoyNextDlg 1)
;;;While
  (while (/= JoyNextDlg nil)
    (cond
      ((= JoyNextDlg 1)
       (setq JoyNextDlg nil)
       (if (null JoyTagSplash)
(JoyDelaySplash) ;_ SplashForm
;;;FirstForm
(dcl_Form_Show DuctilCAD_DuctilCAD_MainForm)
       ) ;_ fim de if
      )
    ) ;_ fim de cond
  )