Problem with Get in RibbonBar

Problem with Get in RibbonBar

Postby marzio » Wed May 02, 2018 8:53 am

Hello.
i have a Get in a group of a ribbonbar:
Code: Select all  Expand view

cVar := Space(10)
DEFINE WINDOW oWnd FROM 0, 0 TO 10, 25
DEFINE RIBBONBAR oBar WINDOW oWnd PROMPT "prova1", "prova2" HEIGHT 157 TOPMARGIN 25
ADD GROUP oGr RIBBON oBar TO OPTION 1 PROMPT "prova" WIDTH 350
@ 30, 100 GET oGet VAR cVar OF oGr SIZE 100, 22 PIXEL
ACTIVATE WINDOW oWnd MAXIMIZED
 

if i insert some datas in the get then i move the mouse outside and inside of the GET the inserted datas disappear.
Any suggestion to avoid this behavior?
thanks
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: Problem with Get in RibbonBar

Postby Antonio Linares » Wed May 02, 2018 10:19 am

Marzio,

Here you have a workaround:

Code: Select all  Expand view
#include "FiveWin.ch"
#include "Ribbon.ch"

function Main()

   local cVar := Space(10), oWnd, oBar, oGr, oGet, oEvent

   DEFINE WINDOW oWnd FROM 0, 0 TO 10, 25

   DEFINE RIBBONBAR oBar WINDOW oWnd PROMPT "prova1", "prova2" HEIGHT 157 TOPMARGIN 25

   ADD GROUP oGr RIBBON oBar TO OPTION 1 PROMPT "prova" WIDTH 350

   AAdd( oGr:aControls, oEvent := TEvent() )

   oEvent:bRefresh = { || oGet:Assign() }

   @ 30, 100 GET oGet VAR cVar OF oGr SIZE 100, 22 PIXEL

   ACTIVATE WINDOW oWnd MAXIMIZED

return nil

CLASS TEvent

   DATA bRefresh

   METHOD Refresh() INLINE Eval( ::bRefresh )

ENDCLASS
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41326
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problem with Get in RibbonBar

Postby Silvio.Falconi » Wed May 02, 2018 2:13 pm

this topic would also interest me because I could add a search for a table in the ribbonbar.
I filled out the test but when I resizeed in the window gave me this error

Code: Select all  Expand view
Application
===========
   Path and name: C:\Work\errori\Ribbon_get\test.Exe (32 bits)
   Size: 3,687,424 bytes
   Compiler version: Harbour 3.2.0dev (r1703231115)
   FiveWin  version: FWH 17.12
   C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
   Windows version: 6.1, Build 7601 Service Pack 1

   Time from start: 0 hours 0 mins 20 secs
   Error occurred at: 05/02/18, 16:11:15
   Error description: Error BASE/1004  Message not found: TEVENT:HIDE
   Args:
     [   1] = O   TEVENT

Stack Calls
===========
   Called from:  => __ERRRT_SBASE( 0 )
   Called from: ../../../tobject.prg => TEVENT:ERROR( 0 )
   Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
   Called from: ../../../tobject.prg => TEVENT:MSGNOTFOUND( 0 )
   Called from: ../../../tobject.prg => TEVENT:HIDE( 0 )
   Called from: .\source\classes\TRIBBON.PRG => (b)TRIBBONBAR_RESIZE( 1240 )
   Called from:  => AEVAL( 0 )
   Called from: .\source\classes\TRIBBON.PRG => TRIBBONBAR:RESIZE( 1240 )
   Called from: .\source\classes\TRIBBON.PRG => TRIBBONBAR:HANDLEEVENT( 1154 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3356 )
   Called from:  => WNDADJTOP( 0 )
   Called from: .\source\classes\CONTROL.PRG => (b)TCONTROL( 122 )
   Called from: .\source\classes\CONTROL.PRG => TRIBBONBAR:ADJTOP( 0 )
   Called from: .\source\classes\WINDOW.PRG => TWINDOW:RESIZE( 2198 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3356 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1037 )
   Called from: test.prg => MAIN( 20 )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6801
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with Get in RibbonBar

Postby marzio » Thu May 03, 2018 7:11 am

thanks Antonio for your help.
i have tried the code and the problem is solved,
but i have an error when i confirm with 'Return'
Message not found: TEVENT:NID
Called from: => __ERRRT_SBASE( 0 )
Called from: ../../../tobject.prg => TEVENT:ERROR( 0 )
Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
Called from: ../../../tobject.prg => TEVENT:MSGNOTFOUND( 0 )
Called from: ../../../tobject.prg => TEVENT:NID( 0 )
Called from: .\source\classes\CONTROL.PRG => (b)TCONTROL_KEYCHAR( 0 )
Called from: => ASCAN( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:KEYCHAR( 0 )
Called from: .\source\classes\TGET.PRG => TGET:KEYCHAR( 0 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 0 )
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 0 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 0 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 0 )
Called from: samspe.prg => SAMSPE( 20 )

i have tried with two gets:
Code: Select all  Expand view

#include "FiveWin.ch"
#include "Ribbon.ch"

function Main()

local cVar := SPACE(10), cVar2 := Space(10), oWnd, oGr, oGet, oGet2, oEvent

   DEFINE WINDOW oWnd FROM 0, 0 TO 10, 25
   DEFINE RIBBONBAR oBar WINDOW oWnd PROMPT "prova1", "prova2" HEIGHT 157 TOPMARGIN 25
   ADD GROUP oGr RIBBON oBar TO OPTION 1 PROMPT "prova" WIDTH 350
   AAdd( oGr:aControls, oEvent := TEvent() )

   oEvent:bRefresh = { || oGet:Assign(), oGet2:Assign() }

   @ 30, 100 GET oGet  VAR cVar  OF oGr SIZE 100, 22 PIXEL
   @ 60, 100 GET oGet2 VAR cVar2 OF oGr SIZE 100, 22 PIXEL

   ACTIVATE WINDOW oWnd MAXIMIZED

return nil
 


but i have another error when i confirm or i move to second or first get:
Message not found: TEVENT:BWHEN
Called from: => __ERRRT_SBASE( 0 )
Called from: ../../../tobject.prg => TEVENT:ERROR( 0 )
Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
Called from: ../../../tobject.prg => TEVENT:MSGNOTFOUND( 0 )
Called from: ../../../tobject.prg => TEVENT:BWHEN( 0 )
Called from: .\source\classes\WINDOW.PRG => TRBGROUP:AEVALWHEN( 0 )
Called from: .\source\classes\CONTROL.PRG => TGET:FORWHEN( 0 )
Called from: .\source\classes\CONTROL.PRG => TGET:FWLOSTFOCUS( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 0 )
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 0 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 0 )
Called from: => SYSREFRESH( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:KEYCHAR( 0 )
Called from: .\source\classes\TGET.PRG => TGET:KEYCHAR( 0 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 0 )
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 0 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 0 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 0 )
Called from: samspe.prg => SAMSPE( 20 )
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: Problem with Get in RibbonBar

Postby marzio » Thu May 03, 2018 7:37 am

i have avoided the error declaring bWhen, nId like DATA
Code: Select all  Expand view
CLASS TEvent

   DATA bRefresh, bWhen, nId, Hide, Show

   METHOD Refresh() INLINE Eval( ::bRefresh )

ENDCLASS


i have the same problem with selection, if i select the test inserted in the get, moving the mouse the selection disappear.
Also the cursor if moved toward right return to the left position moving the mouse.
Antonio have you another workaround for theese 2 problems?
thanks

Silvio, declare Hide and Show: DATA
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: Problem with Get in RibbonBar

Postby Antonio Linares » Thu May 03, 2018 9:23 am

Marzio,

Very good :-)

Try this:

oEvent:bRefresh = { || oGet:Assign(), oGet:LostFocus() }
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41326
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problem with Get in RibbonBar

Postby marzio » Thu May 03, 2018 9:31 am

Antonio,
oGet:LostFocus() doesn't resolve the 2 problem of selection that disappear and the cursor that move to the left.
oGet:oGet:buffer = nil also with the data inserted, until i confirm data with 'return'.
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: Problem with Get in RibbonBar

Postby Antonio Linares » Thu May 03, 2018 11:43 am

Marzio,

Add a DATA nPos to oEvent or a DATA Cargo and keep an array there for each GET

oEvent:bRefresh = { || oGet:Assign(), oEvent:nPos := oGet:nPos }

oGet:bGotFocus = { || oGet:SetPos( oEvent:nPos ) }
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41326
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problem with Get in RibbonBar

Postby marzio » Fri May 04, 2018 7:24 am

Antonio, this is a try with one get but doesn't work.
can you post an example with 2 gets?

Code: Select all  Expand view
function Main()

local cVar := SPACE(10), cVar2 := Space(10), oWnd, oGr, oGet, oGet2, oEvent

   DEFINE WINDOW oWnd FROM 0, 0 TO 10, 25
   DEFINE RIBBONBAR oBar WINDOW oWnd PROMPT "prova1", "prova2" HEIGHT 157 TOPMARGIN 25
   ADD GROUP oGr RIBBON oBar TO OPTION 1 PROMPT "prova" WIDTH 350
   AAdd( oGr:aControls, oEvent := TEvent() )

   oEvent:bRefresh = { || oGet:Assign(), oEvent:nPos := oGet:nPos, oGet:GetSelPos( @oEvent:nStart, @oEvent:nEnd ) }

   @ 30, 100 GET oGet  VAR cVar  OF oGr SIZE 100, 22 PIXEL
//   @ 60, 100 GET oGet2 VAR cVar2 OF oGr SIZE 100, 22 PIXEL
 
   oGet:bGotFocus = { || oGet:SetPos( oEvent:nPos ), oGet:SetSel( oEvent:nStart, oEvent:nEnd ) }

   ACTIVATE WINDOW oWnd MAXIMIZED

return NIL

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

CLASS TEvent

   DATA bRefresh, nPos, nStart, nEnd, Cargo, bWhen, nId, Hide, Show

   METHOD Refresh() INLINE Eval( ::bRefresh )

ENDCLASS
 
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: Problem with Get in RibbonBar

Postby Antonio Linares » Fri May 04, 2018 5:12 pm

Marzio,

I am testing this but it is not working as expected:

Code: Select all  Expand view
#include "FiveWin.ch"
#include "Ribbon.ch"

function Main()

   local cVar := SPACE(10), cVar2 := Space(10), oWnd, oBar, oGr, oGet, oGet2, oEvent

   DEFINE WINDOW oWnd FROM 0, 0 TO 10, 25
   DEFINE RIBBONBAR oBar WINDOW oWnd PROMPT "prova1", "prova2" HEIGHT 157 TOPMARGIN 25
   ADD GROUP oGr RIBBON oBar TO OPTION 1 PROMPT "prova" WIDTH 350
   AAdd( oGr:aControls, oEvent := TEvent() )

   oEvent:bRefresh = { || oGet:Assign(),;
                          If( oGr:lMover,;
                              AEval( oGr:aControls, { | oCtrl | oCtrl:Assign(),;
                                                                oCtrl:Cargo := { oCtrl:nPos, 0, 0 },;
                                                                If( oCtrl:oGet != nil, oCtrl:oGet:Pos := oCtrl:nPos,),;
                                                                oCtrl:GetSelPos( @oCtrl:Cargo[ 2 ], @oCtrl:Cargo[ 3 ] ) } ),;
                              AEval( oGr:aControls, { | oCtrl | MsgBeep(), oCtrl:nPos := oCtrl:Cargo[ 1 ],;
                                                                oCtrl:SetSel( oCtrl:Cargo[ 2 ], oCtrl:Cargo[ 3 ] ) } ) ) }
   @ 30, 100 GET oGet  VAR cVar  OF oGr SIZE 100, 22 PIXEL
   @ 60, 100 GET oGet2 VAR cVar2 OF oGr SIZE 100, 22 PIXEL
 
   oGr:bAction = { || XBrowser( oGr:aControls ) }

   ACTIVATE WINDOW oWnd MAXIMIZED

return NIL

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

CLASS TEvent

   DATA bRefresh, bWhen, nId, Hide, Show, nPos, Cargo, oGet

   METHOD Assign() VIRTUAL
   METHOD GetSelPos() VIRTUAL
   METHOD SetSel() VIRTUAL

   METHOD Refresh() INLINE Eval( ::bRefresh )

ENDCLASS
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41326
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problem with Get in RibbonBar

Postby cnavarro » Fri May 04, 2018 7:26 pm

There are two possible solutions

1) Modify your class TRBGroup

Code: Select all  Expand view


METHOD MouseLeave( nRow, nCol, nFlags ) CLASS TRBGroup

... / ...

   if !Empty( ::aControls )
      //AEval( ::aControls, { | oControl |oControl:Refresh() } )
      AEval( ::aControls, { | oControl | IF( Upper( oControl:ClassName() ) == "TGET",, oControl:Refresh() ) } )
   endif

return lMOverControls

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

METHOD MouseHover( nRow, nCol ) CLASS TRBGroup

.../...

      if !Empty( ::aControls )
         AEval( ::aControls, { | oControl | IF( Upper( oControl:ClassName() ) == "TGET",, oControl:Refresh() ) } )
         //AEval( ::aControls, { | oControl | oControl:Refresh() } )
      endif
   endif

.../...

return nil

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

 


2) As a continuation of Antonio's magnificent example
Since the problem is related to the movement of the mouse, as seen in case 1), then

Code: Select all  Expand view


#include "FiveWin.ch"
#include "Ribbon.ch"

function Main()

   local cVar := SPACE(10), cVar2 := Space(10), oWnd, oBar, oGr, oGet, oGet2, oEvent

   DEFINE WINDOW oWnd FROM 0, 0 TO 10, 25
   DEFINE RIBBONBAR oBar WINDOW oWnd PROMPT "prova1", "prova2" HEIGHT 157 TOPMARGIN 25
   ADD GROUP oGr RIBBON oBar TO OPTION 1 PROMPT "prova" WIDTH 350
   AAdd( oGr:aControls, oEvent := TEvent() )

   oEvent:bRefresh   = { || .T. }
   oEvent:bMouseMove = { || AEVal( oGr:aControls, { | o | if( Upper( o:ClassName() ) == "TGET", , o:Refresh() ) } ) }

   @ 30, 100 GET oGet  VAR cVar  OF oGr SIZE 100, 22 PIXEL
   @ 60, 100 GET oGet2 VAR cVar2 OF oGr SIZE 100, 22 PIXEL
 
   oGr:bAction = { || XBrowser( oGr:aControls ) }

   ACTIVATE WINDOW oWnd MAXIMIZED

return NIL

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

CLASS TEvent

   DATA bRefresh, bMouseMove, bWhen, nId

   METHOD Refresh() INLINE Eval( ::bRefresh )
   METHOD MouseMove() INLINE Eval( ::bMouseMove )

ENDCLASS

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Problem with Get in RibbonBar

Postby Silvio.Falconi » Sat May 05, 2018 8:10 am

try to change movements of Mouse

Static Function GetTimeDblClick()
local oReg := TReg32():New( HKEY_CURRENT_USER, "Control Panel\Mouse" )
local uVar

uVar := oReg:Get( "DoubleClickSpeed", "500" )

IF uVar == NIL
uVar = 500
ENDIF
oReg:Close()

RETURN Val( uVar )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6801
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with Get in RibbonBar

Postby marzio » Mon May 07, 2018 7:53 am

thanks to all,
only the modifying to the class TRBGroup works fine.
it resolve also the problem of the 'cursor' and of the 'selection', but not the problem of the buffer.
i have a button with a clause WHEN !Empty(cVar) .and. !Empty(cVar2)
after entering data on the first GET this BUTTON activates itself only when the second GET (with datas) lost the focus and not when the second GET receive the first character.
also
Code: Select all  Expand view
WHEN !Empty(oGet:oGet:buffer) .AND. !Empty(oGet2:oGet:buffer)
doesn't work:

Code: Select all  Expand view
function Main()

local cVar := SPACE(10), cVar2 := Space(10), oWnd, oGr, oGet, oGet2, oEvent, oBtn

   DEFINE WINDOW oWnd FROM 0, 0 TO 10, 25
   DEFINE RIBBONBAR oBar WINDOW oWnd PROMPT "prova1", "prova2" HEIGHT 157 TOPMARGIN 25
   ADD GROUP oGr RIBBON oBar TO OPTION 1 PROMPT "prova" WIDTH 350
   AAdd( oGr:aControls, oEvent := TEvent() )
   @ 10, 10 ADD BUTTON oBtn GROUP oGr PROMPT "prova" SIZE 60,80 BORDER ACTION Msginfo() WHEN !Empty(cVar) .AND. !Empty(cVar2)
   oEvent:bRefresh = { || oGet:Assign(), oGet2:Assign() }

   @ 30, 100 GET oGet  VAR cVar  OF oGr SIZE 100, 22 PIXEL
   @ 60, 100 GET oGet2 VAR cVar2 OF oGr SIZE 100, 22 PIXEL
 
   ACTIVATE WINDOW oWnd MAXIMIZED

return NIL
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: Problem with Get in RibbonBar

Postby marzio » Tue May 08, 2018 8:42 am

this example works fine.

Code: Select all  Expand view
function Main()

local cVar := SPACE(10), cVar2 := Space(10), oWnd, oGr, oGet, oGet2, oEvent, oBtn

    DEFINE WINDOW oWnd FROM 0, 0 TO 10, 25
    DEFINE RIBBONBAR oBar WINDOW oWnd PROMPT "prova1", "prova2" HEIGHT 157 TOPMARGIN 25
    ADD GROUP oGr RIBBON oBar TO OPTION 1 PROMPT "prova" WIDTH 350
//  AAdd( oGr:aControls, oEvent := TEvent() )
    @ 10, 10 ADD BUTTON oBtn GROUP oGr PROMPT "prova" SIZE 60,80 BORDER ACTION Msginfo() WHEN !Empty(cVar) .AND. !Empty(cVar2)
//  oEvent:bRefresh = { || oGet:Assign(), oGet2:Assign() }

    @ 30, 100 GET oGet  VAR cVar  OF oGr SIZE 100, 22 PIXEL ON CHANGE (cVar  :=  oGet:GetText(), oBtn:ForWhen())
    @ 60, 100 GET oGet2 VAR cVar2 OF oGr SIZE 100, 22 PIXEL ON CHANGE (cVar2 := oGet2:GetText(), oBtn:ForWhen())
 
    ACTIVATE WINDOW oWnd MAXIMIZED

return NIL
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 11 guests