FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Curiosidad XBROWSE
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Curiosidad XBROWSE
Posted: Tue Aug 06, 2013 10:37 PM
Hola.
Podría alguien explicarme por qué funciona bien el siguiente código?

El caso es que el XBrowse no existe en recursos, mucho menos el ID 180.
aArray es un array de un solo elemento con varias filas {1,2,3,4,5,6}, oVent es un boton desde otro dialogo.
Code (fw): Select all Collapse
//---------------------------------//
Function Prueba(aArray,oVent)
local oBrw, oDlg, n
local aRect := GetWndRect( oVent:hWnd )

   DEFINE DIALOG oDlg SIZE 100,100 PIXEL STYLE nor( WS_POPUP, WS_VISIBLE, WS_BORDER)

   REDEFINE XBROWSE oBrw ID 180 OF oDlg ;
         ARRAY aArray

    ACTIVATE DIALOG oDlg ;
         ON INIT ( oDlg:nWidth := oVent:nWidth, oDlg:nHeight:=oBrw:nRowHeight*oBrw:nLen ,;
                   oBrw:SetSize( oDlg:nWidth,oDlg:nHeight ) ,;
                   oDlg:Move(aRect[1] + oVent:nHeight-1, aRect[2]) )
Return nil

Saludos.
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Curiosidad XBROWSE
Posted: Sun Aug 11, 2013 02:26 PM

Only part of the code that must be confusing is why "REDEFINE ...." is working. It should not be difficult to understand why rest of the code is working as is working.

There is no big difference between REDEFINE XBROWE command and @ r,c XBROWSE command, except that in the case of REDEFINE an ID is specified.

If the dialog is created from resource, then the ID should match. Otherwise an error occurs.

Because the dialog is from source code, XBrowse got registered with the ID given instead of registering with a new ID, because there was no conflict.

While we can understand the internal working and why it worked, it is not desirable to use REDEFINE with a non-resource dialog.

Regards



G. N. Rao.

Hyderabad, India
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Curiosidad XBROWSE
Posted: Sun Aug 11, 2013 03:44 PM
Only part of the code that must be confusing is why "REDEFINE ...." is working.

Yes, that's.

There is no big difference between REDEFINE XBROWE command and @ r,c XBROWSE command, except that in the case of REDEFINE an ID is specified.
Yes, I know that.

If the dialog is created from resource, then the ID should match. Otherwise an error occurs.

Yes, I know that.

Because the dialog is from source code, XBrowse got registered with the ID given instead of registering with a new ID, because there was no conflict.

This is new for me.

it is not desirable to use REDEFINE with a non-resource dialog.

Yes I know.

It all started when a user asked me to modify the code, and I found out that I had left this part, unconsciously. So I thought found a curious case, and I posted it here.

Regards.
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql

Continue the discussion