Simplicty and flexibility!


Center the forms


Started by Per Ove Berg-Roren
Search
You will need to Sign In to be able to add or comment on the forum!

Center the forms

is there any solution to center the forms when i opening this in dease withouty to place this in center and use current windows placement in document:properties:windows placement -> currrent

per ove


Written by Per Ove Berg-Roren 09/02/21 at 17:17:56 Dataease [{8}]FIVE

Re:Center the forms

Hi Per Ove.

Yes, definitely.

A lot changed over the DE8 project and still is. LE8 which is the next version of DE8 will have a lot of new stuff inherited from Big Brother (DE9) but that is another story.

In DE8 we focused on giving developers/users more flexibility to achieve more tailormade solutions compared to previous versions of DFW.

The function you look at is located in SetCurrent() which is part of the Set family of functions. (SetState(), SetColor(),SetStyle(),SetCurrent(),SetValue(),SetLabelText(),SetFocus(),SetVar() - I think I got them all.

http://www.dataease.com/dg3_HelpView/?PageID=13803...

You find them all in the Help section on this page.

The one you are looking for is: 
SetCurrent("WindowPos","C","C") -- Will set the current Window Centre/Centre.

If you always want this windows to be opened centered you can put it as derivation on a virtual field and combine it with SetState("ObjectName","Hide") where ObjectName is the ObjectName of the field you execute it from. This way you hide that field. We normally call these fields "Manip" so the derivation of the virtual field Manip would be.

SetState("Manip","Hide")+SetCurrent("WindowsPos","C","C")

You can add any number of functions to this chain with + 

Obviously you can use this function to set the window anywhere ("C","C") is just a simple way of centering that save you from having to calculate where the left upper corner should be positioned to center the window.

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.

As you see from the list above you can do much more than position a window. You can change the class, look, size, activate a windows/hide it etc.

And this is just SetCurrent(), imagine all the things you can do with all the other ones and in combination with PRE 8 functions and all the Get functions which will give you current values.

Also take a look at DEOS() which is our "operating system commands". DEOS() is much expanded in DE9 but still very useful in DE8.

PS! Per Ove. It looks like you are running a very old version of DE8, download the latest from this site as there is bigger differnce beween 8.0 and 8.5 than between 5.x and 8.0


Written by DataEase 09/02/21 at 17:29:06 Dataease [{8}]FIVE
DG3_ForumList