From: Alexander S.K. <al...@be...> - 2015-07-10 10:12:17
|
> > @ 10,10 OwnerButton oBtn TEXT "My State" of oDlg Size 130,30 on click > {||ShowMe(oBtn)} > > oDlg:Activate(,,,.T.) > > > Function ShowMe(oBtn) > hwg_msginfo(str(oBtn:state)) //Return OBTN_NORMAL=1 should be OBTN_PRESSED=3 > The ON CLICK event occurs after releasing the mouse button ( WM_LBUTTONUP ) - that's way the state is OBTN_NORMAL already. > If !oBtn:lPress > hwg_MsgInfo("oBtn, not lPress := .F.") //should be lPress := .T. > EndIf > If !oBtn:lCheck > hwg_MsgInfo("oBtn, not lCheck := .F.") //should be lCheck := .T. > EndIf > > //--------------8<------------ > So when these flags(lPress and lCheck) are activated ? > :lCheck is set manually in your program, by using the CHECK clause of OWNERBUTTON command or directly: oBtn:lCheck := .T. ( it is .F. by default ) It is a property of a button - when it is set to .T., the button behaves like a checkbox - it keeps pressed state after clicking on it and may switch to a normal state after next click. :lPress works only when :lCheck is set to .T. Look at the utils/editor/editor.prg - ownerbuttons with CHECK clause are used there to provide a behaviour like in WordPad and other editors. Regards, Alexander. |