wbrowse scopes...

Post Reply
User avatar
pymsoft
Posts: 383
Joined: Tue Oct 11, 2005 1:01 pm
Location: Savona - Italia
Contact:

wbrowse scopes...

Post by pymsoft »

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

          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
Contact:

Post by pymsoft »

Sorry... wrong language...
Pedro Gonzalez
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

James Bott wrote:Try also setting bLogicLen:

oLBXPrzAlt:bLogicLen := prz_alt->( ordKeyCount() )
You missed the codeblock. :-)

EMG
User avatar
pymsoft
Posts: 383
Joined: Tue Oct 11, 2005 1:01 pm
Location: Savona - Italia
Contact:

Post by pymsoft »

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

          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
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
pymsoft
Posts: 383
Joined: Tue Oct 11, 2005 1:01 pm
Location: Savona - Italia
Contact:

Post by pymsoft »

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
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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/homepage ... rogram.htm

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

I'm glad to hear that too.

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

Post by pymsoft »

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
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
Post Reply