FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveLinux / FiveDroid (Android) An Extra Option for buttons and a Thank You
Posts: 464
Joined: Tue May 16, 2006 07:47 AM
An Extra Option for buttons and a Thank You
Posted: Sat Apr 05, 2008 09: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

HB_FUNC( BTNNOFOCUS ) 
{
  gtk_button_set_focus_on_click( GTK_BUTTON( hb_parnl( 1 ) ), FALSE );
}


and this to button.prg

   METHOD SetNoFocusOnClick() INLINE BtnNoFocus( ::hWnd )


now if you code as follows

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

@ row, col BUTTON oBtn PROMPT "Some Prompt" ACTION( etc
oBtn:SetNoFocusOnClick()


just do it in one line

@ row, col BUTTON "Some Prompt" NOFOCUS ACTION( etc


Regards
Doug
(xProgrammer)

Continue the discussion