wbrowse scopes...

wbrowse scopes...

Postby pymsoft » Mon Jan 14, 2008 11:04 am

wbrowse (el original de FW) en un dialogo dentro de un folder en determinadas situaciones que explicaré a continuación, me quita los scopes.

Abro el dialogo y muestro los datos con el scope sin problemas, me muevo con la rueda del mouse arriba y abajo, con las teclas, sin problemas.
Cuando pongo una ventana adelante y luego me muevo con la rueda del mouse me doy cuenta que me quitó el scope. O cuando hago click para redimensionar la columna y luego me muevo con la rueda del mouse el scope no está mas definido, y no depende de mis funciones, visto que no quito el scope en ningun momento (solo cuando cierro el dialogo).

puse este codigo para cuando pierde el focus para resolver el asunto

Code: Select all  Expand view
          oLBXPrzAlt:bGotFocus := {|| prz_alt->( ordSetFocus(4) ),;
                                      prz_alt->( ordScope( TOPSCOPE, cCodCpc ) ),;
                                      prz_alt->( ordScope( BOTTOMSCOPE, cCodCpc ) ),;
                                      prz_alt->( dbGoTop() )  }


pero me es util solo cuando pierde el focus y luego lo retoma, no cuando redimensiono la columna y luego me muevo con la ruedita del mouse...


A alguien le pasa?

Buscando en la wbrowse no veo en ninguna parte que elimine el scope, asi que estará en algunas de las funciones en C, que no las entiendo...

Saludos
Pedro Gonzalez
User avatar
pymsoft
 
Posts: 383
Joined: Tue Oct 11, 2005 1:01 pm
Location: Savona - Italia

Postby pymsoft » Mon Jan 14, 2008 11:05 am

Sorry... wrong language...
Pedro Gonzalez
User avatar
pymsoft
 
Posts: 383
Joined: Tue Oct 11, 2005 1:01 pm
Location: Savona - Italia

Postby James Bott » Mon Jan 14, 2008 5:39 pm

Pedro,

Try also setting bLogicLen:

oLBXPrzAlt:bLogicLen := prz_alt->( ordKeyCount() )

Also make sure you are specifying the alias when you build the browse.

Why are you setting the scope when getting focus? This is very unusual.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Mon Jan 14, 2008 5:52 pm

James Bott wrote:Try also setting bLogicLen:

oLBXPrzAlt:bLogicLen := prz_alt->( ordKeyCount() )


You missed the codeblock. :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby pymsoft » Mon Jan 14, 2008 5:54 pm

James,

Is very unusual... but the problem is that twbrowse lost the scopes. Not always, but when dialog lost the focus and press the mouse in the adjust column, the scope say good bye... not all the time...

this is my code for the browse:

Code: Select all  Expand view
          oV:cScopeCliente1 := cCodCpc
          oV:cScopeCliente2 := cCodCpc
          prz_alt->( ordSetFocus(4) ) // codice cliente
          prz_alt->( ordScope( TOPSCOPE, oV:cScopeCliente1 ) )
          prz_alt->( ordScope( BOTTOMSCOPE, oV:cScopeCliente1 ) )
          prz_alt->( dbGoTop() )

          REDEFINE LISTBOX oLBXPrzAlt FIELDS IIF( !EMPTY( prz_alt->cat_cod ) .OR. !EMPTY( prz_alt->codfor ), IIF( EMPTY( prz_alt->codfor ), NameCateg( prz_alt->cat_cod ), ( ALLTRIM( NameCateg( prz_alt->cat_cod ) ) + "-" + NameCLF( prz_alt->codfor ) ) ), NameArt( prz_alt->cod_art ) ),;
                   TRANSFORM( prz_alt->prezzo, "@e 999,999.99"),;
                   TRANSFORM( prz_alt->sc1, "@e 999.99"),;
                   TRANSFORM( prz_alt->sc2, "@e 999.99"),;
                   TRANSFORM( prz_alt->sc3, "@e 999.99"),;
                   TRANSFORM( prz_alt->netto, "@e 999,999.99"),;
                   TRANSFORM( prz_alt->data, "@d" );
                   ALIAS "prz_alt";
                   HEADERS "Articolo/Categoria/Forn.", "Prezzo", "SC1", "SC2", "SC3", "Netto", "Data";
                   ON LEFT DBLCLICK NewPrzAlt( oLBXPrzAlt, .F. );
                   ID 201;
                   OF oFld:aDialogs[4]
          // this is to solve (temporaly) the problem
          oLBXPrzAlt:bGotFocus := {|| prz_alt->( ordSetFocus(4) ),;
                                      prz_alt->( ordScope( TOPSCOPE, cCodCpc ) ),;
                                      prz_alt->( ordScope( BOTTOMSCOPE, cCodCpc ) ),;
                                      prz_alt->( dbGoTop() ),;
                                      oLBXPrzAlt:refresh(.T.)  }


          // this is for test
          oLBXPrzAlt:bRClicked := {||  msginfo( PADR( prz_alt->( ordSetFocus() ), 20 ) + CRLF +;
                                                PADR( prz_alt->( dbOrderInfo( DBOI_SCOPEBOTTOM  ) ), 20 ) + CRLF +;
                                                PADR( prz_alt->( dbOrderInfo( DBOI_SCOPETOP  ) ), 20 ) + CRLF + ;
                                                PADR( prz_alt->( recno() ), 20 )             )  }





Thank you for your time.
Pedro Gonzalez
User avatar
pymsoft
 
Posts: 383
Joined: Tue Oct 11, 2005 1:01 pm
Location: Savona - Italia

Postby James Bott » Mon Jan 14, 2008 6:35 pm

Pedro,

OK, you using bGotFocus just as a workaround for the problem. So let's try to find the problem. I suggest commenting out your bGotFocus and putting in this line:

oLBXPrzAlt:bLogicLen := {|| prz_alt->( ordKeyCount() ) }

(as Enrico pointed out it needs to be a codeblock).

Also try commenting out this line:

ON LEFT DBLCLICK NewPrzAlt( oLBXPrzAlt, .F. );

I don't know what is going on in NewPrzAlt() but you are passing the browse object so let's eliminate that as a source of the problem.

If the problem still is there, perhaps you can build us a small sample that we can use to recreate the problem?

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby pymsoft » Tue Jan 15, 2008 10:03 am

James,

:oops: It's my fault...

I have a timer that import data from a database every 45 seconds... and save and retrieves the work areas... recno, focus, selected...

the class twbrowse don't lost the scopes...

Thank you again.


Regards
Pedro Gonzalez
User avatar
pymsoft
 
Posts: 383
Joined: Tue Oct 11, 2005 1:01 pm
Location: Savona - Italia

Postby James Bott » Tue Jan 15, 2008 5:16 pm

Pedro,

Glad you found the problem.

> have a timer that import data from a database every 45 seconds... and save and retrieves the work areas... recno, focus, selected...

I just open a new copy of the database rather than trying to save and restore the state. Unlike the old days when memory was a real issue, today it isn't.

You may want to consider using a database class--they are so much easier to program. FW has one and I have one that is more advanced. My TData class automatically opens a database in a new area so you never have to deal with areas. More info here:

http://ourworld.compuserve.com/homepages/jbott/program.htm

>the class twbrowse don't lost the scopes...

I'm glad to hear that too.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby pymsoft » Wed Jan 16, 2008 9:12 am

James,

I'll try to open a copy of the database with diferent aliases to solve the problem.
I will try to use a database class.

Thanks again

Regards,
Pedro Gonzalez
User avatar
pymsoft
 
Posts: 383
Joined: Tue Oct 11, 2005 1:01 pm
Location: Savona - Italia

Postby James Bott » Wed Jan 16, 2008 6:50 pm

Pedro,

>I will try to use a database class.

Even if you don't use my database class, there are some articles about using database classes on my website that may help you understand them.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests