Page 1 of 1

DC_Dot suggestion

Posted: Mon Mar 22, 2010 3:01 pm
by Tom
DC_Dot called via hotkey inside an app is extremely useful, especially for debugging. But whenever I want to access the objects on the dialog calling DC_Dot, I have to make at least one of those PRIVATE (in most cases the dialog itself - but I don't want to do this). Would it be possible to have the dialog object calling DC_Dot somewhere as a var or as the result of a function? All other objects can be accessed via the ChildList()-method, so having the dialog object itself would do the job.

Re: DC_Dot suggestion

Posted: Mon Mar 22, 2010 4:34 pm
by rdonnay
That is a reasonable request and a good idea.
This will be in build 255. Here's what you need to do to add this to your code.
There will be a new Get-Set function that will be used to store pointers to an array of information.
At the dot-prompt you will use the function DC_DotVar() to retrieve this info.

_DCGETBX.PRG (approx. line 4547), make the following change:

Code: Select all

    ELSEIF mp1 == DC_DotHotKey(,@bDotBlock)
      DC_ClearEvents()
      Eval(bDotBlock,{oParentDlg,aGetList,oGetList})  <<<<<< new parameters
_DCGETBX.PRG (add the following function)

Code: Select all

FUNCTION DC_DotVar( oDlg )

STATIC soDlg

IF PCount() == 1
  soDlg := oDlg
ENDIF

RETURN soDlg
_DCGETBX.PRG (change the following function)

Code: Select all

FUNCTION DC_DotHotKey( nKey, bBlock )

STATIC snHotKey := xbeK_ALT_D, ;
       sbBlock := {|oDlg,o|o := DC_WaitOn('Please wait while loading DCLIP1.DLL'), ;
                     DllLoad('DCLIP1.DLL'), ;
                     DC_Impl(o), ;
                     DC_DotVar(oDlg), ;  <<<<<<<<<<< new
                     &('DC_Dot(.t.)'), ;
                     DC_DotVar(nil)}  <<<<<<<<<<< new

LOCAL nOldHotKey := snHotKey

IF Valtype(nKey) = 'N'
   snHotKey := nKey
ENDIF

bBlock := sbBlock

RETURN nOldHotKey