Simplicty and flexibility!


Function::Internal

SetCurrent
SetCurrent("ActivateDE") -- Activate DE environment for GUI updating.
SetCurrent("ActiveDoc","DocumentName") -- Bring to front and activate Document
SetCurrent("ScrollTo","ScrollX","ScrollY") -- Force the active document to Scroll.
SetCurrent("@DefaultPrinter") -- Will set the Windows Default Printer.
SetCurrent("@Printer3","Hp LaserJet 4700") -- Will set The workstation printer 3 to HP LaserJet 4700
SetCurrent("WindowBorder","NoEdge") -- Will remove caption and border from current window.
SetCirremt("Size","ObjectName","100","100") -- Will set the size of ObjectName to 100 x 100.
SetCurrent("Move","ObjectName","Xpos","YPos") -- Will Move object to xpos, ypos.
SetCurrent("WindowBorder","NoEdge") -- Will remove caption and border from current window.
SetCurrent("WindowClass","Modal") -- WIll make the current window modal.
SetCurrent("WindowPos","C","C") -- Will set the current Window Centre/Centre.
SetCurrent("WindowSize","200","100") -- Will set the current window 200px wide and 100px high.
SetCurrent("WindowType","NorMax") -- will size the window to maximum size to fit in MainWindow.
SetCurrent("Statusbar","Off") -- Switch off the statusbar.
SetCurrent("Tabbar","Off") -- Switch off the Tabbar.
SetCurrent("Toolbar","Off") -- Switch off the Toolbar.
SetCurrent("Filemenu","Off","Keepline") -- Seitch off the FileMenu but will keep the white background.
SetCurrent("AllBars","Off") -- Will switch off File Menu/Toolbar/Tabbar and Statusline in Runtime.
SetCurrent("NewDatalink",enginename, databaseName, serverName, dblinkName) -- Create new DBLink
SetCurrent("DeleteDatalink",dblinkName) -- Delete DBLink
SetCurrent("RefreshDatalink",dblinkName) -- Refresh a DBLink and rebuild all tables etc.
SetCurrent("RecordsInForm", subformName, newNumberAmount) -- Change dynamically (in Runtime) the number of rows displayed in a subform
SetCurrent("ActiveWindow","WindowHandle") -- Switch active window to new window via Window Handle. Similar to SetCurrent("ActiveDoc") but more precise as it will deal with two or more windows with same document.
SetCurrent("CatalogDirty","yes"/"no") -- 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.


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.

Parameters


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

WindowBorderParameter
- 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
WindowClassParameters
- Modal makes the current window modal
- Normal turns off modal for all windows
WindowPosx, 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.
WindowSizewidth, 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.
WindowTypeParameter
- 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

StatusbarParameter
- on turn on statusbar
- off turn off statusbar
TabbarParameter
- on turn on tab bar
- off turn off tab bar
ToolbarParameter
- on turn on toolbar
- off turn off toolbar
FilemenuParameter
- 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.

Returns/Result


Nothing.

Examples


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.

Reference

See Also


GetCurrent()
Current
SetState()

On the forum about SetCurrent

DQL - Setcurrent & Setstate

Dear allCan we use a "manip" field with the set of instructions as follows :setstate ("manip", 0 )+ SetCurrent("WindowBorder","NoEdge")+SetCurrent("WindowClass","Modal")+ SetCurrent("WindowPos","10","80"),in a body of a DQL proced...

Product: Dataease [{8}]FIVE. Written by afonso santos 13/06/16 at 22:44:45

Re:DQL - Setcurrent

Hi Afonso.You can't do it in body as the Body on the "old style DQL" is not properly part of the GUI system.However we did a test and you can do it from inside the DQL.Define "retval" text .retval :=&nbsp;SetCurrent("Window...

Product: Dataease [{8}]FIVE. Written by DataEase 14/06/16 at 20:05:40

SetCurrent(WindowBorder,NoEdge)

hiewhy is it that the statement below doesnt work on dataease player 8.5.0.2500, especially NoEdge and Modal. It works only on the Developer.setstate ("manip", 0 )+ SetCurrent("WindowBorder","NoEdge")+SetCurrent("WindowClass","Modal")+ S...

Product: Dataease [{8}]FIVE. Written by Godfrey 26/01/17 at 12:52:01

Re:SetCurrent(WindowBorder,NoEdge)

Download Sample We just tested this in 8.5.0.2500 and it seems to work excellent ;-)The...

Product: Dataease [{8}]FIVE. Written by DataEase 27/01/17 at 15:13:25

Using Player/Security Level/Custom FileMenu & SetCurrent() to tailor the user experience.

The best way is to use the Player instead of the developer.&nbsp; Download Player! <img style="width:100%" src="/static/ulimages/Capture...

Product: Dataease [{8}]FIVE. Written by DataEase 20/04/17 at 15:08:30

On the blog about SetCurrent

ScrollTo added to SetCurrent() - Force your document to scroll with programming (Ver. 8.5.0.2096)

Download Sample! Even though we are getting close to DataEase 8.5 Production release, the deve...

Product: Dataease [{8}]FIVE. Written by DataEase 08/01/16 at 14:24:52


dg3_HelpView