DtePick

Post Reply
Frank Demont
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

DtePick

Post by Frank Demont »

Hello,

I try to improve the visibility from Dtepicker when it has focus , from resources with DTS_SHOWNONE .

When the Date object receives focus , the checkbox should indicate he has focus , but this isn't always clear . In one from mine aplications , there are 3 date objects. All off them seems to have focus.

So i try to use bgotfocus , to activate the first numeric get (nDay) when the object receives focus (blue !!!) simulating to press VK_RIGHT ( it works , but .... )

The problem is , when we leave the get object , and give it focus again , it give focus to the next element (nMonth) , .....

So this work arround suppose that the checkbox has focus , then the first numeric get is activated . BUT I FOUND NOTHING TO KNOW WHICH FROM THE 4 (Checkbox , nDay , nMonth , nYear) has focus when bgotfocus is activated.

Can this be done ???

Frank

Testing on Samples\testdtp :

Code: Select all

#include "FiveWin.ch"
#include "dtpicker.ch"
# include "vKey.ch"
#xtranslate bDtePick       => ( {|el|IIF(EMPTY(el:Varget()) , ,  el:PostMsg(  WM_KEYDOWN , VK_RIGHT , 0)) , nil} )

FUNCTION Main()

   local oWnd, oSay
   local dDate := Date()

   DEFINE WINDOW oWnd TITLE "DTPicker from code ...."

   @ 2, 2 DTPICKER dDate OF oWnd ON CHANGE If( oSay != nil, oSay:Refresh(),)

   @ 3, 30 SAY oSay PROMPT "Date: "+ Dtoc( dDate ) OF oWnd SIZE 200, 20

   @ 6, 2 BUTTON "From resources ..." OF oWnd ACTION FromRes( oWnd ) SIZE 150, 30

   ACTIVATE WINDOW oWnd

return nil

FUNCTION FromRes( oWnd )
   local oDlg, oSay , obj
   local dDate := Date()
	 local Geh
   DEFINE DIALOG oDlg RESOURCE "DTPTEST"

   REDEFINE DTPICKER obj VAR dDate ID 101 OF oDlg ;
      ON CHANGE oSay:Refresh()
	 Obj:bGotFocus  := bDtePick //{|el|IIF(EMPTY(el:Varget()) , ,  el:PostMsg(  WM_KEYDOWN , 39 , 0)) , nil}
   REDEFINE SAY oSay PROMPT "Date: "+ Dtoc(dDate) ID 102 OF oDlg
   ACTIVATE DIALOG oDlg CENTERED
return nil

#include "..\include\WinApi.ch"

DTPTEST DIALOG 6, 15, 207, 56
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "DTPicker test from resources ..."
FONT 8, "MS Sans Serif"
{
 CONTROL "", 101, "SysDateTimePick32", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP| DTS_SHOWNONE, 16, 13, 81, 14
 EDITTEXT 102, 16, 33, 81, 11
 DEFPUSHBUTTON "Close", IDOK, 148, 6, 50, 14
}


User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Frank,

I have tried using EM_GETSEL to know what portion is selected but without success.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply