gotfocus for dc_tabpage

This forum is for eXpress++ general support.
Message
Author
c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

gotfocus for dc_tabpage

#1 Post by c-tec »

Hello Roger,
it seems that the gotfocus codeblock is called twice every time, what can I do to prevent this ?
regards
Rudolf

Code: Select all

 bGotFocus := {||Build_t2(2,GetList,oBrowse),dc_getrefresh(aoTabMsg[2])}
@  0,0 DCTABPAGE aoTabPage[2] CAPTION '&Transaktionen' RELATIVE aoTabPage[1] STATICAREA aoTabStatic[2];
               GOTFOCUS bGotFocus PARENT oMainStatic ACCELKEY xbeK_ALT_T


...

function build_t2(nTab,aGetlist,oBrowse) 
******************************************************************
local getlist := {}
local getoptions := {}
local nLeft := SIZE_X-20
local nLine := 1
local bColor,oDialog
if !aTabs[nTab]

     @ .5,.5 DCSAY {||DP_KUNNAME} SAYHVCENTER FONT '12.Arial Bold' SAYSIZE SIZE_X - 22,1.4 PARENT aoTabStatic[nTab] COLOR GRA_CLR_YELLOW,GRA_CLR_DARKBLUE OBJECT aoTabMsg[nTab]

     @ 2.1,.5 DCBROWSE oBrowse9 PARENT aoTabStatic[nTab] ALIAS "DOKU" SIZE  SIZE_X-22,SIZE_Y-6   FREEZELEFT { 1 } PRESENTATION cstat("BROWSEPRES") ID 'BROWSE4' SCOPE;
          COLOR {||{GRA_CLR_BLACK,GraMakeRGBColor(cstat("SYS_BROWSECOLOR"))}}  DATALINK {||doku->(edit_doku(0,getlist,"KUN"))} CURSORMODE XBPBRW_CURSOR_ROW ZEBRA {|lEven|zebra(lEven)}

     DCBROWSECOL FIELD doku->nummer     WIDTH 3  HEADER "Nummer"     PARENT oBrowse9  ID 'BROWSE9_1'
     DCBROWSECOL FIELD doku->art        WIDTH 5  HEADER "Art"        PARENT oBrowse9  ID 'BROWSE9_2'
     DCBROWSECOL FIELD doku->TEXT       WIDTH 20 HEADER "Text"       PARENT oBrowse9  ID 'BROWSE9_5'
     DCBROWSECOL FIELD doku->dokument   WIDTH 50 HEADER "Dokument"   PARENT oBrowse9  ID 'BROWSE9_6'
     DCBROWSECOL FIELD doku->user       WIDTH 5  HEADER "User"       PARENT oBrowse9  ID 'BROWSE9_7'
     DCBROWSECOL FIELD doku->datum      WIDTH 5  HEADER "Datum"      PARENT oBrowse9  ID 'BROWSE9_3'
     DCBROWSECOL FIELD doku->zeit       WIDTH 5  HEADER "Zeit"       PARENT oBrowse9  ID 'BROWSE9_4'
     aoTabPage[nTab]:lockUpdate(.t.)
     DCREAD GUI PARENT aoTabPage[nTab] EXIT  OPTIONS GetOptions SAVE PARENT @oDialog
     DC_MergeGetLists(aGetList,GetList)
     aoTabPage[nTab]:lockUpdate(.f.)
     aTabs[nTab] := .t.
endif
init_tab("DOKU",oBrowse9)
PostAppEvent(xbeP_Keyboard,xbeK_CTRL_PGDN,,oBrowse9)
SetAppFocus(oBrowse9)
return .t.

Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: gotfocus for dc_tabpage

#2 Post by rdonnay »

I can't see the problem from the code that you have posted. It may be something in the init_tab() function.
The eXpress train is coming - and it has more cars.

User avatar
Tom
Posts: 1234
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: gotfocus for dc_tabpage

#3 Post by Tom »

Hi, Rudolf.

I ran into the same problem. Now I simply set a memvar and catch if the dialog building is already done or not:

Code: Select all

lDlgBuilt := .F.
bGotFocus := {||IF(!lDlgBuilt,(Build_t2(2,GetList,oBrowse),dc_getrefresh(aoTabMsg[2])),nil),lDlgBuilt:=.T.}
You may also use a get-/set-function for this.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

reganc
Posts: 259
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: gotfocus for dc_tabpage

#4 Post by reganc »

rdonnay wrote:I can't see the problem from the code that you have posted. It may be something in the init_tab() function.
Roger

I was checking the docs yesterday and noticed that you added a MERGECHILDREN clause to DCTABPAGE. Would that not work here?
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: gotfocus for dc_tabpage

#5 Post by c-tec »

Hello Tom,
so the problem with gotfocus is not only in my application. Thank you for the tip, I will try it.
If I have time, I try to make a small sample app to show the problem.
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: gotfocus for dc_tabpage

#6 Post by c-tec »

Hello Tom,
found that the soulution does not work for me. The build_t functions create the getlist elements and set the focus for the table. If I call it only once, I cannot change the focus when changing to another master record. I already check this with my aTabs array if the getlistelements are already attached. So it is difficult to differ between the second call of getfocus to refresh the table scope.
I think I have to do this with checking the last time when the tabpage has got focus.
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: gotfocus for dc_tabpage

#7 Post by c-tec »

Hello,
found a strange thing. When I insert a altd(), the program stops twice each gotfocus, if I insert a dcqdebug, it works correct and shows only once a message when the tabpage gets focus. Maybe this can help Roger to find the problem.
regards
Rudolf

Code: Select all

...
local bColor,oDialog
//altd()   // stop twice each gotfocus
//dcqdebug "go focus!" // called only once on each gotfocus
if !aTabs[nTab]

     @ .5,.5 DCSAY {||DP_KUNNAME} SAYHVCENTER FONT '12.Arial Bold' SAYSIZE SIZE_X - 22,1.4 PARENT aoTabStatic[nTab] COLOR GRA_CLR_YELLOW,GRA_CLR_DARKBLUE OBJECT aoTabMsg[nTab]

     @ 2.1,.5 DCBROWSE oBrowse9 PAR
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

skiman
Posts: 1199
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: gotfocus for dc_tabpage

#8 Post by skiman »

Hi,

I was wondering why i never noticed this, because I use about the same code in my application.

If I set a 'WTF' in the beginning of my 'buildget()', the function is only called once? Is this something that is started from a certain version?
Best regards,

Chris.
www.aboservice.be

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: gotfocus for dc_tabpage

#9 Post by c-tec »

Hello,
I think it was in all versions, I always noticed it as strange flickering in such dialogs, now I know that it is gotfocus
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

skiman
Posts: 1199
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: gotfocus for dc_tabpage

#10 Post by skiman »

Hi Rudolf,

I doubt that the gotfocus is the cause.

I have the following:
...GOTFOCUS {|a,b,oTab| oTab:tofront(), BuildGets(aTabPages,1,GetList,aBuildGets,aApp,oDialog) }

FUNCTION BuildGets( aTabPages, i, aGetLst,aBuildGets,aApp,oDialog )
Local ...
WTF i
...

In buildgets I have a 'WTF i' as first line, and this is called only once.
Best regards,

Chris.
www.aboservice.be

Post Reply