An Extra Option for buttons and a Thank You

An Extra Option for buttons and a Thank You

Postby xProgrammer » Sat Apr 05, 2008 9:54 am

Firstly a big thank you to Antonio for his recent help changing default selection when tabbing through GETs. Combined with my workaround for controlling tab order it has made for some nice comments from my end users and made them more productive.

Whilst I was controlling the order when tabbing through GETs and keeping buttons that should not have been tabbed through avoided, there remained the issue of these buttons grabbing the focus when clicked on.

That was relatively easy to fix by adding the following code to buttons.c

Code: Select all  Expand view
HB_FUNC( BTNNOFOCUS )
{
  gtk_button_set_focus_on_click( GTK_BUTTON( hb_parnl( 1 ) ), FALSE );
}


and this to button.prg

Code: Select all  Expand view
   METHOD SetNoFocusOnClick() INLINE BtnNoFocus( ::hWnd )


now if you code as follows

Code: Select all  Expand view
oBtn:SetNoFocusOnClick()


then when you click on oBtn the focus will stay set where it was.

I note that this might be very useful for buttons on toolbars.

Also a question to Antonio and other users. Should this be an option on BUTTON creation - in other words should @ row, col BUTTON command have a new clause, maybe NOFOCUS, to support such a capability directly rather than code along the following lines

Code: Select all  Expand view
@ row, col BUTTON oBtn PROMPT "Some Prompt" ACTION( etc
oBtn:SetNoFocusOnClick()


just do it in one line

Code: Select all  Expand view
@ row, col BUTTON "Some Prompt" NOFOCUS ACTION( etc


Regards
Doug
(xProgrammer)
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Return to FiveLinux / FiveDroid (Android)

Who is online

Users browsing this forum: No registered users and 3 guests