GetLayerUserId Method

Build 1501 on 14/Nov/2017  This topic last edited on: 23/Mar/2016, at 12:14

Description

Returns the id of the user who holds the current layer in use, if it's not you.

Note 1: if you're the user of the layer, it returns 0.

Note 2: It may return 0 if you don't click on the page first.

Note 3: a better function is GetObjCurEditorId Script

Syntax

dim iUserId as Integer = Page.GetLayerUserId

Example

  Public Function GetLayersUsersId()

    ' returns a 4-col array with one row per layer: layerid, layername, layeruserid, layerusername

    ' if in use by me in the current session, Page.GetLayerUserId=0, Page.GetLayerUserName=""

    Dim i As Integer

    Dim aUsers(Page.GetLayersCount, 3)

    Dim curlayerIdx = Page.GetCurLayer

    For i = 0 To Page.GetLayersCount - 1

      Page.LayerSelect(i)

      aUsers(i, 0) = Page.GetLayerId

      aUsers(i, 1) = Page.GetLayerName

      aUsers(i, 2) = Page.GetLayerUserId 'returns 0 if nobody or me in the current session, otherwise user id

      aUsers(i, 3) = Page.GetLayerUserName 'returns "" if nobody or me in the current session, otherwise user logon name

    Next

    Page.LayerSelect(curlayerIdx)

    Return aUsers

  End Function

Context

Page designer

All layers related commands

CanLayerRecover

GetCurLayer, GetLayerId, GetLayerLockLevel, GetLayerName, GetLayersCount,GetLayerTypeId, GetLayerUserId, GetLayerUserName

IsLayerChecked, IsLayerFrozen, IsLayerListChecked, IsLayerLocked, IsLayerVisible

LayerAdd, LayerDelete, LayerEditDlg, LayerJumpTo, LayerListToggleCheck, LayerMerge, LayerNoJumpTo, LayerRecover, LayersCopyContent, LayerSelect, LayerSelectIdName, LayerTest, LayerToBack, LayerToFront, LayerToggleCheck, LayerToggleFreeze, LayerToggleLock, LayerToggleVisible

TxtLayersDlg