PdcWindows.ActiveWindow: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:
== Code example ==
== Code example ==
Loop through the selected rows of the active window if it is the calculationlist and shows the calculation text.
Loop through the selected rows of the active window if it is the calculationlist and shows the calculation text.
!!! Note !!! Do not use a message box before reading the active window's key values into a stringlist. The click on the message box will change the selection to only the last selected line.


<source lang="vb">
<source lang="vb">

Revision as of 14:48, 17 December 2015

Declaration

ActiveWindow as PdcWindow

Description

Returns the window object of the active window

Notes

This property returns the window object for the active window in Plan-de-CAMpagne.

Code example

Loop through the selected rows of the active window if it is the calculationlist and shows the calculation text. !!! Note !!! Do not use a message box before reading the active window's key values into a stringlist. The click on the message box will change the selection to only the last selected line.

dim activewindow
dim intTel
dim objCalc
dim KeyValues

    set ActiveWindow = pdc.Windows.ActiveWindow
    if ActiveWindow.WindowKey = "32" then 'Calculationlist
      set KeyValues = ActiveWindow.KeyValues
      for intTel = 0 to KeyValues.Count -1
        set objCalc = pdc.OpenCalculation(KeyValues(intTel))
        if IsValid(objCalc) then
          MsgBox objCalc.Text
        end if
      Next
    else
      msgbox "This script does not work with the opened window in PdC (Windowkey " & ActiveWindow.WindowKey & ")." & vbCrLf & _
             "It works only with the calculationlist (Windowkey 32)."
    end if
    set KeyValues = nothing
    set objCalc = nothing
    set ActiveWindow = nothing

Availability

Available from 4.0 onwards.