mkyx Posted June 10, 2019 Report Share Posted June 10, 2019 Pessoal o que pode está errado na rotina abaixo, pois eu clico em qualquer um dos nome e só mostra o primeiro nome da lista: #include "fivewin.ch" function main() define dialog rel_11 title "teste" hist:={"ze","mane","maria","pedro","joao"} li_1:=15 _pos:=100 for qth=1 to 5 I0:=STRZERO(QTH,3) c_obj:="V_H"+I0 hh:=HIST[qth] @ LI_1,50 SAY &C_OBJ. VAR HIST[qth] PIXEL OF rel_11 SIZE _POS,15 &C_OBJ.:lWantClick = .t. &C_OBJ.:bLClicked = { || _movim(hh) } &C_OBJ.:CTOOLTIP:=ALLTRIM(hh) &c_obj.:cvarName:=ALLTRIM(hh) li_1:=li_1+15 next activate dialog rel_11 centered return .t. FUNCTION _movim(REL_111) N_HIST:="" for ii=1 to len(REL_11:aControls) if upper(REL_11:aControls[ii]:className())="TSAY" .AND. REL_11:aControls[ii]:lFocused // verifica se é um objeto SAY e se foi o que recebeu o click do mouse N_HIST:=rel_11:aControls[ii]:cVarName // aqui pega o nome da variável II:=len(rel_11:aControls)+10 // aqui agiliza para sair do loop for-next ENDIF next ii ? "O nome onde o mouse tocou é = ",N_HIST return .t. Eu não sei, se essa declaração REL_11:aControls[ii]:lFocused é realmente o comando para saber onde o mouse clicou. Alguém saberia informar? Obrigado Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 11, 2019 Report Share Posted June 11, 2019 \samples\TESTSAY2.PRG // A sample showing to to let a SAY accept Clicks events #include "FiveWin.ch" #define COLOR_BTNFACE 15 function Main() local oDlg, oSay, oCursor DEFINE CURSOR oCursor HAND DEFINE DIALOG oDlg @ 2, 2 SAY oSay PROMPT "Test" BORDER ; COLORS CLR_HRED, CLR_WHITE oSay:lWantClick = .t. oSay:bLClicked = { || oSay:SetColor( CLR_WHITE, GetSysColor( COLOR_BTNFACE ) ),; oSay:Refresh(), MsgInfo( "Hello" ) } oSay:oCursor = oCursor ACTIVATE DIALOG oDlg CENTERED return nil Quote Link to comment Share on other sites More sharing options...
mkyx Posted June 12, 2019 Author Report Share Posted June 12, 2019 Boa noite, resolvi assim: #include "fivewin.ch" function main() define dialog rel_11 title "teste" hist:={"ze","mane","maria","pedro","joao"} li_1:=15 _pos:=100 for qth=1 to 5 I0:=STRZERO(QTH,3) c_obj:="V_H"+I0 hh:=HIST[qth] @ LI_1,50 SAY &C_OBJ. VAR HIST[qth] PIXEL OF rel_11 SIZE _POS,15 &C_OBJ.:lWantClick = .t. &C_OBJ.:bLClicked = { || _movim(&c_obj.:cvarName) } &C_OBJ.:CTOOLTIP:=ALLTRIM(hh) &c_obj.:cvarName:=ALLTRIM(hh) li_1:=li_1+15 next activate dialog rel_11 centered return .t. FUNCTION _movim(REL_111) ? rel_111 return .t. Blz. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.