Setting focus on an object in bLostfocus

Setting focus on an object in bLostfocus

Postby demont frank » Mon Jul 09, 2007 10:20 am

Hello,

Trying To use msginfo() after the user leaves a get , i tryed with :

oGet:bLostfocus := {||msginfo("some text')}

The problem is that the next get seems to have focus , BUT NOT VISIBLE

I tryed everithing mentioned in this forum, you can test with
Code: Select all  Expand view  RUN
#include "FiveWin.ch"
function Main()
   LOCAL oDlg, oGet[4]
   LOCAL cCad := "Testing    "   LOCAL nNum := 0
   LOCAL dDat := Date()
    LOCAL n := 0

   Set century On
   Set Date Ansi
   Set Date format "mm/dd/yyyy"

   SET _3DLOOK ON

   DEFINE DIALOG oDlg TITLE "TGet from " + FWDESCRIPTION
   @ 1,    2 SAY "Text..:" OF oDlg
   @ 1,    6 GET oGet[1] VAR cCad OF oDlg SIZE 60, 10 COLOR "W/G" PICTURE "@K"
   @ 1.8,  2 SAY "Number:" OF oDlg
   @ 2,    6 GET oGet[2] VAR nNum OF oDlg SIZE 60, 10 PICTURE "9999999.99"
    oGet[2]:bLostFocus := {||MsgInfo("Focus not visible on oGet[3]") , Test(oGet , nNum) } // , oGet[2]:Setfocus()}
   @ 2.6,  2 SAY "Date:" OF oDlg
   @ 3,    6 GET oGet[3] VAR dDat PICTURE "@E" OF oDlg SIZE 60, 10 //WHEN .f. // "@D"
   oGet[3]:lDisColors = .f. // don't use standard disabled colors
   @ 3,    7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 3,   16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

   ACTIVATE DIALOG oDlg CENTERED ;
      //VALID MsgYesNo( "Want to end ?" )

return nil

//------------------------------------------------------------------------//
*****************************************************************************************
PROC Test(oGet , n)
*******************
IF n == 0
   // Nothing , no code
ELSEIF n == 1
   oGet[3]:SetFocus()
ELSEIF n == 2
   xSetfocus(oGet[3]) ; xSetfocus(oGet[3]) ; xSetfocus(oGet[3])       // repeating , Maurilio Viana 23/2/2007
ELSEIF n == 3
   PostMessage( oGet[2]:hWnd ,FM_CHANGEFOCUS)                         // Manuramos 26/2/2007
ELSEIF n == 4
   SendMessage( oGet[2]:hWnd , FM_CHANGEFOCUS)
ELSEIF n == 5
   PostMessage( oGet[2]:hWnd , FW_SETFOCUS)
ELSEIF n == 6
   SendMessage( oGet[2]:hWnd , FW_SETFOCUS)    
END      
RETURN
function xSetFocus( oObx )
**************************
// function from local.fivewin.english 4/1/2003 Kleyber Derick
local oTempo:=""
local lGet := oObx:ClassName $ "TGET TMULTIGET"
define timer oTempo interval 10 of oObx:oWnd ;
  action (oObx:SetFocus(), IIF(lGet , oObx:SetPos(0) , ), oTempo:Deactivate() )
activate timer oTempo

return nil

procedure appsys
return



Frank
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby Antonio Linares » Mon Jul 09, 2007 11:09 am

Frank,

If you call MsgInfo() from a lost focus operation then you are modifying the normal focus sequence. Try to use a MsgBeep() or another call that do not affect the focus:

oGet:bLostfocus := {|| MsgBeep() }

or

oGet:bLostfocus := {|| oDlg:SetText("some text') }
This one changes the dialog caption
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42100
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests