Difference between revisions of "Application:set"
From GiderosMobile
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | |||
'''Available since:''' Gideros 2015.7<br/> | '''Available since:''' Gideros 2015.7<br/> | ||
'''Class:''' [[Application]]<br/> | '''Class:''' [[Application]]<br/> | ||
Line 6: | Line 5: | ||
=== Description === | === Description === | ||
Sets the state of the desktop setting provided as string parameter. | Sets the state of the desktop setting provided as string parameter. | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | application:set(setting,value) | ||
+ | </syntaxhighlight> | ||
− | + | '''new''' Gideros 2023.11: implement '''application:set("statusBar")''' for Android and iOS</br> | |
− | application:set(" | + | '''new''' Gideros 2022.1: implement '''application:set("wintabMode")''' |
− | </ | + | |
+ | === Parameters === | ||
+ | '''setting''': (string) the desktop setting<br/> | ||
+ | '''value''': (varies) the new setting value(s)<br/> | ||
+ | === '''Compatibility table''' === | ||
+ | {| class="wikitable" style="text-align: center;" | ||
+ | !!!QT!!Win32!!UWP!!Android!!Apple MacOS!!Apple iOS!!Apple tvOS!!Linux!!HTML | ||
+ | |- | ||
+ | |clipboard||X||X||||||||||||X|| | ||
+ | |- | ||
+ | |cursor||X||X||X||||X||||||X||X | ||
+ | |- | ||
+ | |cursorPosition||X||X|||||||||||||| | ||
+ | |- | ||
+ | |documentDirectory||X||X||||||||||||X|| | ||
+ | |- | ||
+ | |maximumSize||X|||||||||||||||| | ||
+ | |- | ||
+ | |minimumSize||X|||||||||||||||| | ||
+ | |- | ||
+ | |mkDir||X||X||||||||||||X|| | ||
+ | |- | ||
+ | |statusBar||||||||X||||X|||||| | ||
+ | |- | ||
+ | |temporaryDirectory||X||X||||||||||||X|| | ||
+ | |- | ||
+ | |windowColor||X|||||||||||||||| | ||
+ | |- | ||
+ | |windowModel||X|||||||||||||||| | ||
+ | |- | ||
+ | |windowPosition||X||X||||||||||||X|| | ||
+ | |- | ||
+ | |windowSize||X||X||||||||||||X|| | ||
+ | |- | ||
+ | |windowTitle||X||X||||||||||||X||X | ||
+ | |- | ||
+ | |wintabMode||X|||||||||||||||| | ||
+ | |} | ||
+ | === List of available parameters and settings === | ||
To get a list of parameters that can be set use: | To get a list of parameters that can be set use: | ||
− | + | <syntaxhighlight lang="lua"> | |
− | < | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
print(application:set("help")) | print(application:set("help")) | ||
--[[ | --[[ | ||
Line 43: | Line 70: | ||
- temporaryDirectory(path) | - temporaryDirectory(path) | ||
]] | ]] | ||
+ | </syntaxhighlight> | ||
− | + | To get help for individual settings use: | |
− | + | <syntaxhighlight lang="lua"> | |
− | + | print(application:set("cursor","help")) -- eg: cursor | |
− | |||
− | print(application:set("cursor","help")) | ||
--[[ | --[[ | ||
+ | Accepted value for cursor : | ||
- arrow | - arrow | ||
- upArrow | - upArrow | ||
Line 60: | Line 87: | ||
- sizeFDiag | - sizeFDiag | ||
- sizeAll | - sizeAll | ||
− | - blank | + | - blank -- not available on win32 |
- splitV | - splitV | ||
- splitH | - splitH | ||
Line 67: | Line 94: | ||
- whatsThis | - whatsThis | ||
- busy | - busy | ||
− | - openHand | + | - openHand -- not available on win32 |
− | - closedHand | + | - closedHand -- not available on win32 |
− | - dragCopy | + | - dragCopy -- not available on win32 |
− | - dragMove | + | - dragMove -- not available on win32 |
− | - dragLink | + | - dragLink -- not available on win32 |
+ | ]] | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <syntaxhighlight lang="lua"> | ||
+ | print(application:set("windowModel","help")) -- eg: window mode | ||
+ | --[[ | ||
+ | Accepted value for windowModel : | ||
+ | - reset | ||
+ | - stayOnTop | ||
+ | - stayOnBottom | ||
+ | - frameless | ||
+ | - noTitleBar | ||
+ | - noButton | ||
+ | - onlyMinimize | ||
+ | - onlyMaximize | ||
+ | - onlyClose | ||
+ | - noMinimize | ||
+ | - noMaximize | ||
+ | - noClose | ||
+ | - helpButton | ||
]] | ]] | ||
+ | </syntaxhighlight> | ||
+ | === Examples === | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | application:set("windowPosition", 64, 64) | ||
+ | application:set("windowColor", 0, 0, 0) | ||
+ | application:set("windowTitle", "My lovely window title") | ||
application:set("cursor", "openHand") | application:set("cursor", "openHand") | ||
− | </ | + | </syntaxhighlight> |
+ | |||
+ | <syntaxhighlight lang="lua"> | ||
+ | -- global app size | ||
+ | myappleft, myapptop, myappright, myappbot = application:getLogicalBounds() | ||
+ | myappwidth, myappheight = myappright - myappleft, myappbot - myapptop | ||
+ | |||
+ | if application:getDeviceInfo() == "Windows" and not application:isPlayerMode() then | ||
+ | application:set("windowPosition", myappwidth * 1.2, 16) | ||
+ | application:set("windowModel", "onlyClose") | ||
+ | -- application:set("windowModel", "noMaximize") -- doesn't work for me! | ||
+ | application:set("windowTitle", "App Title") | ||
+ | application:set("minimumSize", myappwidth, myappheight) | ||
+ | application:set("maximumSize", myappwidth, myappheight) | ||
+ | application:set("windowColor", 0, 0, 0) | ||
+ | end | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <syntaxhighlight lang="lua"> | ||
+ | -- \\dirName on Windows (could be \/ on Linux - not tested) | ||
+ | application:set("mkDir", application:get("directory","executable").."\\dirName") | ||
+ | </syntaxhighlight> | ||
{{Application}} | {{Application}} |
Latest revision as of 16:22, 31 May 2024
Available since: Gideros 2015.7
Class: Application
Description
Sets the state of the desktop setting provided as string parameter.
application:set(setting,value)
new Gideros 2023.11: implement application:set("statusBar") for Android and iOS
new Gideros 2022.1: implement application:set("wintabMode")
Parameters
setting: (string) the desktop setting
value: (varies) the new setting value(s)
Compatibility table
QT | Win32 | UWP | Android | Apple MacOS | Apple iOS | Apple tvOS | Linux | HTML | |
---|---|---|---|---|---|---|---|---|---|
clipboard | X | X | X | ||||||
cursor | X | X | X | X | X | X | |||
cursorPosition | X | X | |||||||
documentDirectory | X | X | X | ||||||
maximumSize | X | ||||||||
minimumSize | X | ||||||||
mkDir | X | X | X | ||||||
statusBar | X | X | |||||||
temporaryDirectory | X | X | X | ||||||
windowColor | X | ||||||||
windowModel | X | ||||||||
windowPosition | X | X | X | ||||||
windowSize | X | X | X | ||||||
windowTitle | X | X | X | X | |||||
wintabMode | X |
List of available parameters and settings
To get a list of parameters that can be set use:
print(application:set("help"))
--[[
- windowPosition(x,y)
- windowSize(w,h)
- minimumSize(w,h)
- maximumSize(w,h)
- windowColor(r,g,b)
- windowTitle(text)
- windowModel(type//help)
- cursor(type//help)
- cursorPosition(x,y)
- clipboard(text)
- mkdir(path|dirName//help)
- documentDirectory(path)
- temporaryDirectory(path)
]]
To get help for individual settings use:
print(application:set("cursor","help")) -- eg: cursor
--[[
Accepted value for cursor :
- arrow
- upArrow
- cross
- wait
- IBeam
- sizeVer
- sizeHor
- sizeBDiag
- sizeFDiag
- sizeAll
- blank -- not available on win32
- splitV
- splitH
- pointingHand
- forbidden
- whatsThis
- busy
- openHand -- not available on win32
- closedHand -- not available on win32
- dragCopy -- not available on win32
- dragMove -- not available on win32
- dragLink -- not available on win32
]]
print(application:set("windowModel","help")) -- eg: window mode
--[[
Accepted value for windowModel :
- reset
- stayOnTop
- stayOnBottom
- frameless
- noTitleBar
- noButton
- onlyMinimize
- onlyMaximize
- onlyClose
- noMinimize
- noMaximize
- noClose
- helpButton
]]
Examples
application:set("windowPosition", 64, 64)
application:set("windowColor", 0, 0, 0)
application:set("windowTitle", "My lovely window title")
application:set("cursor", "openHand")
-- global app size
myappleft, myapptop, myappright, myappbot = application:getLogicalBounds()
myappwidth, myappheight = myappright - myappleft, myappbot - myapptop
if application:getDeviceInfo() == "Windows" and not application:isPlayerMode() then
application:set("windowPosition", myappwidth * 1.2, 16)
application:set("windowModel", "onlyClose")
-- application:set("windowModel", "noMaximize") -- doesn't work for me!
application:set("windowTitle", "App Title")
application:set("minimumSize", myappwidth, myappheight)
application:set("maximumSize", myappwidth, myappheight)
application:set("windowColor", 0, 0, 0)
end
-- \\dirName on Windows (could be \/ on Linux - not tested)
application:set("mkDir", application:get("directory","executable").."\\dirName")
- Application:applyStyles
- Application:canOpenUrl
- Application:checkPermission
- Application:configureFrustum
- Application:enableDrawInfo
- Application:enableOnDemandDraw
- Application:exit
- Application:get
- Application:getApiVersion
- Application:getAppId
- Application:getBackgroundColor
- Application:getClipboard
- Application:getContentHeight
- Application:getContentWidth
- Application:getDeviceHeight
- Application:getDeviceInfo
- Application:getDeviceName
- Application:getDeviceOrientation
- Application:getDeviceSafeArea
- Application:getDeviceWidth
- Application:getFps
- Application:getKeyboardModifiers
- Application:getLanguage
- Application:getLocale
- Application:getLogicalBounds
- Application:getLogicalHeight
- Application:getLogicalScaleX
- Application:getLogicalScaleY
- Application:getLogicalTranslateX
- Application:getLogicalTranslateY
- Application:getLogicalWidth
- Application:getNativePath
- Application:getOrientation
- Application:getProjectProperties
- Application:getScaleMode
- Application:getScreenDensity
- Application:getTextureMemoryUsage
- Application:isPlayerMode
- Application:openUrl
- Application:requestPermissions
- Application:set
- Application:setBackgroundColor
- Application:setClipboard
- Application:setEventMerging
- Application:setFps
- Application:setFullScreen
- Application:setKeepAwake
- Application:setKeyboardVisibility
- Application:setLogicalDimensions
- Application:setOrientation
- Application:setScaleMode
- Application:setTextInput
- Application:setWindowSize
- Application:vibrate