Complimentary function to GetCurrent(). Set properties and Environment variables in DataEase environment to change or force action.
First function to be implemented is ActivateDE which will activae DataEase for GUI manipulation etc. If you don't activate the DataEase window before you try to use GUI functions like DocumentOpen(), SetState(), SetValue() etc. they will be ignored.
While SetScurrent("ActivateDE") will activate DataEase, SetCurrent("ActiveDoc","DocName") will bring to front and activate the named document.
SetCurrent("ScrollTo"...) will Scroll the active window to the wanted postion, either relative,absolute or Top,Bottom,Center, Left, Right.
DataEase GUI functions will ALWAYS have the context of the Active window, so if you try to do GUI manipulation from a Timer, you will have to make sure that the correct window is active. If the timer is set and then activated lets say 60 minutes later, you will most likely have navigated away from the window that originated the Timer, so when you are going to perform actions rooting in this window you will need to re-activate it before sending messages to it.
SetCurrent("ActivateDE")
Will force DataEase out of "sleep". This is necessary if you want DataEase to do GUI activities when not being the main active window on your computer.
Ex. You run a timer (timer event on Form Object) and when this timer is up you want to give some feedback to the user by pushing DataEase to front and give it focus so you can do GUI updates and run GUI scripts (like MemoExecDQL and LabelExecDQL).
SetCurrent("ActiveDoc","Documentname")
This function will activate an already open document so it gets the focus. Timer Function and many other async functions will send message to the active document, so you need to make sure that the correct document is active before you send messages to it. You can use this in combination wtih GetCurrent("IsDocOpen","Documentname") so you open the document if it is not already open, and activate it if it is already open.
SetCurrent("ScrollTo","Xpos","Ypos")
This will force the active window to scroll either absolute or relative to the current position, it will scroll both in x and y position.
Xpos:
Absolute: any number will scroll window to this position in X-direction - 0,100,200
Relative: + or - in front of number will scoll relative to current postion: +20 - 100. If you want position to stay the same use +0.
Predefined: L,R,C - This will scroll active Window all the way to Left, Right or Center it.
Ypos:
Absolute: any number will scroll window to this position in Y-Direction - 0, 50, 250
Relative: + or - in front of number will scoll relative to current postion: +20 - 100. If you want position to stay the same use +0.
Predefined: T,R,B - This will scroll active Window all the way to Top, Bottom or Center it.
SetCurrent("Size","ObjectName","XSize","YSize")
Change the size of ObjetName to XSizexYSize. Use +0 to keep one or the other.
Ex:
SetCurrent("Size","Heading",GetCurrent("Width"),"+0") -- will increase the size of heading tot he width of Main Window in x direction
SetCirremt("Size","Button1","+10","+10") -- Will increase the size of Button1 in both direction by 10 on each
SetCurrent("Move","ObjectName","Xpos","YPos")
Will move object either to absolute or relative position. Number will move to absolute and +- in front will move it relative.
Ex:
SetCurrent("Move","ObjectName","100",100") -- will move object to position 100,100 from upper left corner of Window.
setCurrent("Move","ObjectName","+10","+10") -- Will move object relative to current position with 10 pixels in both directions.
SetCurrent("@DefaultPrinter","Printername")
Set the default printer to the given name: SetCurrent("@DefaultPrinter","Hp Laserjet 4500")
Returns Success/Fail
SetCurrent("@PrinterN","Printername")
Set Workstation Printer N to the given value. SetCurrent("@Printer4","Hp Laserjet 4500") will set the workstation printer for active application/workstation to new value. Permanent!
Returns Success/Fail
Changing the Current Window, border, style, class, position and size
WindowBorder | Parameter - NoEdge that removes caption and borders. - NoCaption removes the caption - Caption add back the caption - thin what windows calls a BORDER - thick what windows calls a THICKFRAME - normal what windows calls a DLGFRAME |
WindowClass | Parameters - Modal makes the current window modal - Normal turns off modal for all windows |
WindowPos | x, y, [width], [height] inside the client windows, can use + or - to add or subtract to current size position or T=top and B=bottom for y and L=left and R=right for x and C=center for both x and y. |
WindowSize | width, height, [x], [y] inside the client windows, can use + or - to add or subtract to current size position or T=top and B=bottom for y and L=left and R=right for x and C=center for both x and y. |
WindowType | Parameter - NorMax normalizes the windows and makes it max size in the client frame. - NorMaxMax normalizes the windows and makes it max size in the client frame. Borders and caption removed. - Normal mormalized the window - Maximize maximizes the window - Minimize minimizes the window |
Switching off and on the different Toolbars/Tabbars/Statusbars and FileMenu
Statusbar | Parameter - on turn on statusbar - off turn off statusbar |
Tabbar | Parameter - on turn on tab bar - off turn off tab bar |
Toolbar | Parameter - on turn on toolbar - off turn off toolbar |
Filemenu | Parameter - on turn on menu - off turn off menu - keepline as parameter 2 will let you keep a blank menu line |
SetCurrent("Statusbar","On/Off")
Switch on or off the statusbar in Runtime.
SetCurrent("Tabbar","On/Off")
Switch on or off the tabbar in Runtime
SetCurrent("Toolbar","On/Off")
Switch on or off the Toolbar in Runtime.
SetCurrent("Filemenu","On/Off"[,"Keepline"])
Seitch on or off the FileMenu. If you add the optional Keepline it will keep the white background.
SetCurrent("AllBars","On/Off")
Will switch off File Menu/Toolbar/Tabbar and Statusline in Runtime
SetCurrent("RecordsInForm","SubformName",Rows)
Will dynamically change the number of rows displayed in a sub-form.
SetCurrent("ActiveWindow","WindowHandle") 9.0
Switch current active window to new already open window with the help of Window Handle rather than Window Title (Caption). This is more precise than SetCurrent("ActiveDoc") as this use the name of the window and can be confused when you have opened the same document tow or more times. You can obtain the WIndowHandle with the help of GetCurrent("WIndowHandle") or the action GETALLWINDOWTITLES ( 31000) which will give you a JSON array containing all open windows with caption and handle.
SetCurrent("CatalogDirty","yes"/"no") 9.0
Will set flag to indicate that data in catalog is dirty or not. Used to reset after refresh of catalog, or to trigger a reload of catalog for any reason if changes has been do in application that need to be reflected in catalog list.
SetCurrent("CutePDFfilename",filename) 8.6
Set output filename to be used next time CutePDF is activated, set in combination with DocumentOpen etc.
In 8.6 we have implemented native support for CutePDF Write so you can control the PDF creation process from inside DE. CutePDFfilename will set the name for the next PDF to be created by your CutePDF write so only set it in in immediate combination with the report you want printed to PDF.
Example 1
define "retval" text .
define "vTimer" time.
define "cTimer" number .
if GetVar("MyTimerActive")="Yes" then
vTimer := GetVar("MyTimer") .
cTimer := vtimer - current time .
if vTImer<= current time then
retval := SetCurrent("ActivateDE") .
retval := RefreshForm() +SetVar("MyTimerActive","No") .
if GetCurrent("IsDocOpen","CalledOnTimer") = "Yes" then
retval := SetCurrent("ActiveDoc","CalledOnTimer") .
message "Is active" window .
else
retval := DocumentOpen("CalledOnTimer") .
end
end
retval := SetValue("CountDown",cTimer) .
end
message concat("Counting down: " , ctimer, " Time: ", current time, " IsDEActive: ", GetCurrent("IsDeActive"), " ActiveDoc: ", GetCurrent("ActiveDoc"), " Window: ", GetCurrent("Windowname")," DocumentName: ",GetCurrent("DocName")," DocumentFileName: ",GetCurrent("DocFileName")) .
This Timer will count down and then Call the Document "CalledOnTimer". It has proper environment control i.e. activates DataEase then it check if the Document "CalledOnTimer" is still open. If it is, it will Activate this Document, if not it will Open it.
The message line is inserted to show you the monitoring capability of Timer. The Message line in all documents (ActiveDoc) will be updated 10 times a second with the correct information including a count down timer and a clock. You can see the active document and you can also see if DataEase is active or not.
GetCurrent()
Current
SetState()
Product: Dataease [{8}]FIVE. Written by afonso santos 13/06/16 at 22:44:45
Product: Dataease [{8}]FIVE. Written by DataEase 14/06/16 at 20:05:40
Product: Dataease [{8}]FIVE. Written by Godfrey 26/01/17 at 12:52:01
Product: Dataease [{8}]FIVE. Written by DataEase 27/01/17 at 15:13:25