Code: Alles auswählen
bblock := "{|"+a+","+b+"| tuwas(a,b) }
Moderator: Moderatoren
Code: Alles auswählen
bblock := "{|"+a+","+b+"| tuwas(a,b) }
AUGE_OHR hat geschrieben:wie bekomme ich "a" und "b" als "Parameter" in den Codeblock ?Code: Alles auswählen
bblock := "{|"+a+","+b+"| tuwas(a,b) }
Code: Alles auswählen
cblock := "{|a,b| tuwas(a,b) } // locale variabel a und b im Codeblock, Inhalt kommt zur Laufzeit
bblock := &(cblock) // codeblock wartet auf Arbeit ...
Eval( bBlock, Var1, Var2 ) // Var1 -> local a | Var2 -> local b
Code: Alles auswählen
{ |a,b| Tuwas(a,b) }
Code: Alles auswählen
cblock := "{|a,b| tuwas(a,b) } // locale variabel a und b im Codeblock, Inhalt kommt zur Laufzeit
bblock := &(cblock) // codeblock wartet auf Arbeit ...
Eval( bBlock, Var1, Var2 )
Yup, aber wie bekomme ich vom GUI Thread die Parameter a,b in den Main Thread ?Martin Altmann hat geschrieben:Code: Alles auswählen
cblock := "{|a,b| tuwas(a,b) } // locale variabel a und b im Codeblock, Inhalt kommt zur Laufzeit bblock := &(cblock) // codeblock wartet auf Arbeit ... Eval( bBlock, Var1, Var2 )
Das, was Du als Var1 angibst, wird im Codeblock als Vriable a übernommen. Analog mit Var2, das ist dann das b
aber das meine ich mit den Parameter "im" Codeblock ( weiss nicht wie ich das sonst bezeichnen soll )Martin Altmann hat geschrieben:das ist eine völlig andere Geschichte
das wird nicht gehen den der GUI Thread "weiss" nichts vom "Main" Thread.Martin Altmann hat geschrieben:Vielleicht mittels einer globalen Variable, in der Du die Referenz auf die entsprechende Klasse (oder den Codeblock selber) vorhältst?
hm ... du bringst mich da auf eine Idee ... muss ich evaluieren...Martin Altmann hat geschrieben:Oder per Message?
das Problem ist, das ich öfter nicht "verstehe" was er damit meintbrandelh hat geschrieben:Pablo hat mal was gesagt ...
Code: Alles auswählen
:itemSelected := {| uNIL1, uNIL2, self | ... }
Code: Alles auswählen
elseif nMsg == WM_NOTIFY
if lp == 0
// must not happen
return NIL
end
if( PeekDWord(lp) == ::hDPick )
return ::_HandleListViewNotify_( PeekDWord(lp,8) , lp )
end
return NIL
Code: Alles auswählen
INLINE METHOD _HandleListViewNotify_( notify_code , p ) // do not call outside GUI thread
local b := iif( ::m_ht==NIL,NIL, _hdict_getprop(::m_ht, cPrintf("LV%08.8X.notify",notify_code)) )
if Valtype(b) =="B"
return Eval(b, Self , notify_code , p )
end
return NIL
Code: Alles auswählen
INLINE METHOD SetLvNotifyCB( notify_code , b )
local k,r
local np := PCount()
if Valtype(notify_code) != "N" ; return NIL ; end
k := cPrintf("LV%08.8X.notify",notify_code)
r := delegated_eval( {|| iif( ::m_ht == NIL,, _hdict_GetProp(::m_ht,k)) } )
if np > 1
if Valtype(b) == "B"
delegated_eval( {|| iif( ::m_ht == NIL,, _hdict_SetProp(::m_ht,k,b)) } )
else
delegated_eval( {|| iif( ::m_ht == NIL,, _hdict_RemoveProp(::m_ht,k)) } )
end
endif
return r
Code: Alles auswählen
::SetLvNotifyCB( DTN_WMKEYDOWN ,;
{|o,notify,lp| ::OnDummy(o,lp,"DTN_WMKEYDOWN" ) } )
Code: Alles auswählen
::SetLvNotifyCB( DTN_WMKEYDOWN ,;
{|o,notify,lp| PostAppEvent(xbeMy_Event,lp ,o,Self) ) } )
Code: Alles auswählen
INLINE METHOD HandleEvent(nEvent,mp1,mp2)
DO CASE
case nEvent == xbeMy_Event
return ::MyCodeblock( mp1 , mp2 )
Code: Alles auswählen
INLINE METHOD MyCodeblock(mp1, mp2)
if Valtype( ::MyCodeblock ) == "B"
eval( ::MyCodeblock, mp1 , mp2 , Self)
end
return NIL
Code: Alles auswählen
Proc Main
oApp := MyClass():New():Create()
oApp:MyCodeblock := {|mp1,mp2,oSelf| tuwas(mp1,mp2)}
Code: Alles auswählen
::SetLvNotifyCB( DTN_WMKEYDOWN ,;
{|o,notify,lp| PostAppEvent(xbeMy_Event,lp ,o,Self) ) } )
Code: Alles auswählen
::SetLvNotifyCB( DTN_WMKEYDOWN ,;
{|o,notify,lp, st| st := MySTRUCTURE():New(),; // STRUCTURE anlegen
st:_write_(lp,0,-1) ,; // Trick Pablo Pointer setzten
PostAppEvent(xbeMy_Event,lp ,st,Self) ) } )
im GUI Thread läuft im Prinzip alles was "echtes" Windows ist wozu auch ActiveX und "native" Controls gehören.UliTs hat geschrieben:Eine Frage: Was ist ein "GUI-Thread"?