LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

No EVENT_COMMIT when clicking Picture Command button label

If I use a PICTURE COMMAND BUTTON and Left Mouse click on the text label for the button, the Button does not actuate and there is no EVENT_COMMIT, only EVENT_LEFT_CLICK. If you Left Mouse Click on any other part of the button then everything works as expected. Is this behavior expected? (LW/CVI 7 & 7.1)
0 Kudos
Message 1 of 10
(6,009 Views)
Yes, this behavior is expected. You have to click within the button area for the button to be depressed, and only then do you receive a commit event.

Luis
NI
0 Kudos
Message 2 of 10
(6,002 Views)
This seems like rather odd behavior for the button to have.

Could the callback be programmed so that the LEFT_CLICK_EVENT showed the button as pressed and then programmatically come back around to the callback and generate the EVENT_COMMIT?
0 Kudos
Message 3 of 10
(6,002 Views)
Yes, it could. You'd need to distinguish between clicks on the label part versus clicks on the button part. You can do that by comparing the mouse coordinates of the click with the label area.
Once you do that, you can use the FakeKeystroke function to simulate a user pressing on the button with either the enter key or the spacebar key. But before you do that, you'll have to set the keyboard focus on the button (clicking on the label will eventually set the focus on the button, but only after the LEFT_CLICK event is sent to the callback).

The following code should do the trick:

GetCtrlAttribute (panel, control, ATTR_LABEL_TOP, &top);
GetCtrlAttribute (panel, control, ATTR_LABEL_LEFT, &left);
GetCtrlAttribute (panel, control, ATTR_LABEL_WI
DTH, &width);
GetCtrlAttribute (panel, control, ATTR_LABEL_HEIGHT, &height);
if (eventData1 >= top && eventData1 < top + height && eventData2 >= left && eventData2 < left + width)
{
SetActiveCtrl (panel, control);
FakeKeystroke (VAL_ENTER_VKEY);
}

Luis
0 Kudos
Message 4 of 10
(6,002 Views)
Excellent.

Thanks for the help.
0 Kudos
Message 5 of 10
(6,002 Views)
Hi  everyone,
 
I developp a numeric keyboard emulation for Tablet PC use and I have a problem with the key push management.
I explain :
I made a numeric keyboard on a panel with picture command button and I manage numeric key push with EVENT_COMMIT and I use FakeKeystroke function to simulate a user pressing on the button and active panel witch contained the numeric control I wanted to set before.
The problem is when I backspace a numeric value. At the last digit the pointer blinking and when I press an other key, the control display the last digit deleted.
How can I solve this problem ?
 
Regards,
 
Jean-Noel Pomies
0 Kudos
Message 6 of 10
(5,849 Views)

Hi~ LuisG

I, according to controlling under the way that you said

But how I want controls the result of letting as this picture below of mine,

In my word on the button, while pushing

http://tw.pg.photos.yahoo.com/ph/chiajeng_lee/detail?.dir=/408bscd&.dnm=e74bscd.jpg&.src=ph

thanks

CJ

由 Chiajeng 在 05-26-2006 04:49 AM 上編輯的訊息

0 Kudos
Message 7 of 10
(5,739 Views)

Hi CJ,

I'm not sure that I understand your question, but if you want to put an image on a command button, this post might be helpful.  In the future, you will have more luck getting replies if you start a new thread instead of posting on an old thread.

Best Regards
Megan B.
National Instruments.

0 Kudos
Message 8 of 10
(5,701 Views)
Hi,Megan B
Thank your replying, but I think that the way in which I want may be unable to accomplish ,
so I add the text  that I want in the picture (icon file).
 
CJ
0 Kudos
Message 9 of 10
(5,671 Views)

I had the same problem, and thanks to D Biel now it's solved. See here

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 10 of 10
(4,615 Views)