Jump to content
Fivewin Brasil

funcao pra retornar a variavel que esta sendo usada no GET


MAMP2

Recommended Posts

#include "FiveWin.ch"

function Main()
   LOCAL oDlg, oGet
   LOCAL cCad := "Testing    " // pad("Testing Gets",40)
   LOCAL nNum := 0
   LOCAL dDat := Date()

   Set century On
   Set Date Ansi
   Set Date format "mm/dd/yyyy"

   SET _3DLOOK ON

   DEFINE DIALOG oDlg TITLE "TGet from " + FWDESCRIPTION
   SetKey(VK_F3, {|| MostraGet(oDlg) } )

   @ 1,    2 SAY "Text..:" OF oDlg
   @ 1,    6 GET oGet VAR cCad OF oDlg SIZE 60, 10 COLOR "W/G" PICTURE "@K"
   @ 1.8,  2 SAY "Number:" OF oDlg
   @ 2,    6 GET oGet VAR nNum OF oDlg SIZE 60, 10 PICTURE "9999999.99"
   @ 2.6,  2 SAY "Date:" OF oDlg
   @ 3,    6 GET oGet VAR dDat PICTURE "@E" OF oDlg SIZE 60, 10  // "@D"
   @ 3,    7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 3,   16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

   ACTIVATE DIALOG oDlg CENTERED

return nil

//------------------------------------------------------------------------//

Function MostraGet(oDlg)
   Local oGetAtual := oDlg:oCtlFocus

   //exibe nome da variável e seu conteúdo
   ? oGetAtual:oGet:Name,oGetAtual:oGet:Buffer

Return nil

 

Link to comment
Share on other sites

  • 1 month later...
Function MostraGet(oDlg)
   Local oGetAtual := oDlg:oCtlFocus

   //exibe nome da variável e seu conteúdo
   ? oGetAtual:oGet:Name,oGetAtual:oGet:Buffer

Return nil

Na linha não. Get atual ele pega do objeto janela, vc poderia verificar se foco está em um objeto get. 

Assim:

Function MostraGet(oDlg)
   Local oGetAtual := oDlg:oCtlFocus

   //exibe nome da variável e seu conteúdo
   If Hb_IsObject(oGetAtual) .and. oGetAtual:ClassName() == "TGET"
      ? oGetAtual:oGet:Name,oGetAtual:oGet:Buffer
   Endif
Return Nil

Possível erro pode ser focu em outro objeto que não seja o objeto do TGET. ok

Link to comment
Share on other sites

Em 19/03/2024 at 19:24, MAMP2 disse:

jmsilva esta dando erro na compilacao nesta linha, tem alguma coisa errada?

 

oGetAtual:oGet:Name,oGetAtual:oGet:Buffer

se é na compilação então vc não concluir a linha correto... esta linha tem um ? (exclamação) no inicio...

 

Link to comment
Share on other sites

2 horas atrás, Theotokos disse:

se é na compilação então vc não concluir a linha correto... esta linha tem um ? (exclamação) no inicio...

 

Vc está usando o #include "fivewin.ch" ?  Tem haver com ponto exclamação.

#command ? [ <list,...> ] => WQout( [ \{ <list> \} ] )

O Ponto de exclamação eu uso para visualizar, pode mudar para:

 

msginfo(oGetAtual:oGet:Name)   //nome da variável
msginfo(oGetAtual:oGet:Buffer) //conteúdo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...