PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 25 → WX - Informatica: Lendo objetos da tela
WX - Informatica: Lendo objetos da tela
Débuté par BOLLER, 13 mai 2019 22:51 - 4 réponses
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 13 mai 2019 - 22:51
// Summary: <specify the procedure action>
// Syntax:
//Screen_05_AddSubElement (<nID>, <sObjName>)
//
// Parameters:
// nID: <specify the role of nID>
// sObjName: <specify the role of sObjName>
// Return Value:
// None
//
// For instance:
// Indicate an example.
//
Procedure Screen_05_AddSubElement(nID, sObjName)

// Fill a combo box with the list of window controls
i is int = 1
ControlName01, Objetos is string
ControlName01 = EnumControl("WIN_GPU_05_Password", i, byTabOrder)

WHILE ControlName01 <> ""

i++

Objetos += ControlName01

IF nID > 0 AND sObjName <> ""

GPU_12_SoftControls.Configuration_ID = 1
GPU_12_SoftControls.Controls_ID = GPU_GetSEQ("GPU_12_SoftControls","Controls_ID")
GPU_12_SoftControls.Soft_ID = 1
GPU_12_SoftControls.WinRepProc_ID = nID
GPU_12_SoftControls.NameControl = sObjName +"."+ ControlName01
GPU_12_SoftControls.Caption = ControlName01
GPU_12_SoftControls.Type = Screen_TipoControle(ControlName01)
GPU_12_SoftControls.Status = "A"
HAdd(GPU_12_SoftControls)

// Browse the panes in a tab control sub itens
ControlName02 is string = EnumSubElement(GPU_12_SoftControls.NameControl, enumFirst + enumPane + enumAll)
WHILE ControlName02 <> ""
// Go to the next pane
ControlName02 = EnumSubElement(GPU_12_SoftControls.NameControl, enumPane + enumPane + enumAll)
GPU_12_SoftControls.Configuration_ID = 1
GPU_12_SoftControls.Controls_ID = GPU_GetSEQ("GPU_12_SoftControls","Controls_ID")
GPU_12_SoftControls.Soft_ID = 1
GPU_12_SoftControls.WinRepProc_ID = nID
GPU_12_SoftControls.NameControl = sObjName +"."+ ControlName02
GPU_12_SoftControls.Caption = ControlName02
GPU_12_SoftControls.Type = Screen_TipoControle(ControlName02)
GPU_12_SoftControls.Status = "A"
HAdd(GPU_12_SoftControls)
END


END

ControlName01 = EnumControl(sObjName, i)

END


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 13 mai 2019 - 22:52
Procedure Screen_TipoControle(NomeControle)

IF NomeControle <> "" THEN

NomeControle = ExtractString(NomeControle,1,"_",FromBeginning)

END

RESULT NomeControle


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 13 mai 2019 - 22:53
Procedure Screen_03_CargaItens(Janela)

TableGrid_ControlItens.DeleteAll()

// Browse the controls
Itens is string = ""
nSubscript is int = 1
sControl0, sControl1, sControl2, sControl3, sControl4, sControl5, sControl6 is string
sParentName is string = Janela //"WIN_Form_tabela"
sControlInfo is string = gpwEnumControl(sParentName, nSubscript)
WHILE sControlInfo <> ""
//Trace(sControlInfo)
// Retrieve the full name of the child control
sControl1 = ExtractString(sControlInfo, 1, TAB) //Full control name *
sControl2 = ExtractString(sControlInfo, 2, TAB) //Full parent name
sControl3 = ExtractString(sControlInfo, 3, TAB) //Type
sControl4 = ExtractString(sControlInfo, 4, TAB) //Plain type *
sControl5 = ExtractString(sControlInfo, 5, TAB) //caption *
sControl6 = ExtractString(sControlInfo, 6, TAB) //tab order
sControl0 = ExtractString(sControl1,1,".",FromEnd)

TableAdd(TableGrid_ControlItens,Janela+"."+sControl1 +TAB+ sControl0 +TAB+ sControl5 +TAB+ sControl4 + TAB+ "")

Screen_02_CreateItens(Janela+"."+sControl1,sControl0,sControl5,sControl4)

//next control
nSubscript++
sControlInfo = gpwEnumControl(sParentName, nSubscript)
Itens += sControl1 + CR
END
//trace(Itens)


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 13 mai 2019 - 22:54
Procedure Screen_10_StatusCombo()

//1 Default
//2 Inactive
//3 Grayed
//4 Invisible

sValueCombo is int = ExtractString(TableGrid_ControlItens[TableGrid_ControlItens],4,TAB,FromBeginning)

gsFullNameControl = TableGrid_ControlItens[TableGrid_ControlItens].COL_Elemento

gsItem = TableGrid_ControlItens[TableGrid_ControlItens].COL_Item

gsCaption = TableGrid_ControlItens[TableGrid_ControlItens].COL_Caption

gsTipo = TableGrid_ControlItens[TableGrid_ControlItens].COL_Tipo


IF HReadSeek(GPU_13_SoftPolicesUsersItens,FullNameControl,gsFullNameControl,hIdentical) = False THEN

IF HFound(GPU_13_SoftPolicesUsersItens) = False

GPU_13_SoftPolicesUsersItens.Controls_ID = GPU_GetSEQ("GPU_13_SoftPolicesUsersItens","ChaveUnica_ID")
GPU_13_SoftPolicesUsersItens.Company_ID = gnCompanyID
GPU_13_SoftPolicesUsersItens.Soft_ID = gnSoftID
GPU_13_SoftPolicesUsersItens.UserGroup_ID = gnUserID
GPU_13_SoftPolicesUsersItens.IsAGroup = gbIsGroup
GPU_13_SoftPolicesUsersItens.WinRepProc_ID = gnWindowID
GPU_13_SoftPolicesUsersItens.NameScreen = gsNameWindow
GPU_13_SoftPolicesUsersItens.FullNameControl= gsFullNameControl //unico
GPU_13_SoftPolicesUsersItens.NameControl = gsItem
GPU_13_SoftPolicesUsersItens.CaptionTxt = gsCaption
GPU_13_SoftPolicesUsersItens.Type = gsTipo
GPU_13_SoftPolicesUsersItens.Status = sValueCombo

HAdd(GPU_13_SoftPolicesUsersItens,hForceIdAuto)

END

ELSE

GPU_13_SoftPolicesUsersItens.Company_ID = gnCompanyID
GPU_13_SoftPolicesUsersItens.Soft_ID = gnSoftID
GPU_13_SoftPolicesUsersItens.UserGroup_ID = gnUserID
GPU_13_SoftPolicesUsersItens.IsAGroup = gbIsGroup
GPU_13_SoftPolicesUsersItens.WinRepProc_ID = gnWindowID
GPU_13_SoftPolicesUsersItens.NameScreen = gsNameWindow
GPU_13_SoftPolicesUsersItens.FullNameControl= gsFullNameControl
GPU_13_SoftPolicesUsersItens.NameControl = gsItem
GPU_13_SoftPolicesUsersItens.CaptionTxt = gsCaption
GPU_13_SoftPolicesUsersItens.Type = gsTipo
GPU_13_SoftPolicesUsersItens.Status = sValueCombo

HModify(GPU_13_SoftPolicesUsersItens)

END


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 13 mai 2019 - 22:54
Procedure Screen_11_GetImageBuffer(sNameTempDir is string, sWindowName is string)

// manage an exception
WHEN EXCEPTION
RESULT False
END

bufImage is Buffer

// create the images of windows
nNbImage is int=WindowBitmap(sWindowName,sNameTempDir+sWindowName)

// failure
IF nNbImage=0 THEN
dbgAssert(False)
RESULT False
ELSE

sNameImageFile is string
// if there is a single image
IF nNbImage=1 THEN
// build the name of the file
sNameImageFile=sNameTempDir+sWindowName+".BMP"
// load the file in a buffer
IMG_THUMBS = sNameImageFile
IF dSaveImageJPEG(IMG_THUMBS,sNameImageFile,80) = True
bufImage=fLoadBuffer(sNameImageFile)
// deletes the file
fDelete(sNameImageFile)
END
// if there are several images
ELSE
// load the file in a buffer
sNameImageFile = sNameTempDir+sWindowName+".B01"
IF fFileExist(sNameImageFile) = True
bufImage=fLoadBuffer(sNameImageFile)
IMG_THUMBS = bufImage
dSaveImageJPEG(IMG_THUMBS,sNameImageFile,80)
bufImage=fLoadBuffer(sNameImageFile)
END
// delete the files from the disk
FOR i=1 _TO_ nNbImage
IF fFileExist(sNameTempDir+sWindowName+".B0"+i) = True
fDelete(sNameTempDir+sWindowName+".B0"+i)
END
END
END

END

// ok
RESULT bufImage


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/