FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Making room for browse with buttonbar in dialog.
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Making room for browse with buttonbar in dialog.
Posted: Thu Apr 17, 2014 10:27 PM

I have a dialog with a resource control for the Class TCBrowse, I want to place a buttonbar inside this control. But when I try this the Bar overwrites the Headers, and the first row of the browse. Once you move the record down 1 record you see the first record, and you never seem to see the browse headers.

How do you place the ButtonBar in the resource and make sure that the browse does not overdraw the buttonbar?

Thanks,

Byron

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Making room for browse with buttonbar in dialog.
Posted: Thu Apr 17, 2014 11:08 PM
Hello,

you can move and resize the browse at ON INIT in dialog to put in the place and the correct size

Code (fw): Select all Collapse
 
...
nTop := oButtonBar:nHeight + 1
...
ACTIVATE DIALOG oDlg ON INIT ( oBrowse:move( nTop, nLeft ), Browse:SetSize( nWidth,  nHeight) )


regards

Marcelo
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: Making room for browse with buttonbar in dialog.
Posted: Fri Apr 18, 2014 12:58 AM

Thank you, I must be doing this wrong. I have a resource dialog, Control ID 102:

Redefine Browse oBrowse ID 102 of oDlg
// setup columns
// setup GoTOp, GoBottom, bSkip, cAlias, etc...
Activate Dialog oDlg On Init DetailBar( oBrowse )

So the browse, and the buttonbar share the same control 102.
When I move the browse [ oBrowse:Move( oBrowse:nTop + 36 ) ] it moves the entire control (bar and browse), but does not change the relationship of the Bar to the Browse.

I

Thanks,

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Making room for browse with buttonbar in dialog.
Posted: Fri Apr 18, 2014 02:13 AM
Hola,

this is a simple sample

Code (fw): Select all Collapse
#include "fivewin.ch"
#include "xBrowse.ch"

function main()
local odlg, oBrw, aData, oBar

aData := {{"1","HOLA","Esto es de prueba"},;
          {"1","HOLA","Esto es de prueba"},;
      {"1","HOLA","Esto es de prueba"},;
      {"1","HOLA","Esto es de prueba"},;
      {"1","HOLA","Esto es de prueba"}}

DEFINE DIALOG oDlg RESOURCE "test"
  REDEFINE xBrowse oBrw ID 1001 OF oDlg ARRAY aData
  oDlg:bResized := {|| oBrw:move( oBar:nHeight,1), oBrw:setSize( oDlg:nWidth - 17, oDlg:nHeight - oBar:nHeight - 21) }
ACTIVATE DIALOG oDlg ON INIT ( oBar := TBar():New( oDlg, 33, 33, .T.,,, .F., .F. ), EVAL( oDlg:bResized ) )

return nil


rc

Code (fw): Select all Collapse
LANGUAGE 0, SUBLANG_NEUTRAL
test DIALOG 99, 89, 426, 294
STYLE DS_SETFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_THICKFRAME | WS_SYSMENU
EXSTYLE WS_EX_WINDOWEDGE
CAPTION "test"
FONT 8, "MS Sans Serif"
{
    CONTROL         "", 1001, "txBrowse", 0x50020000, 7, 16, 413, 251, 0x00000000
}
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Making room for browse with buttonbar in dialog.
Posted: Fri Apr 18, 2014 02:26 AM
Hi, here other sample: ( I included a menu )
Code (fw): Select all Collapse
DEFINE DIALOG oDlg RESOURCE "BLNZAYAUXIL" 
REDEFINE XBROWSE oBrw1 ID 118 OF oDlg ;
        ....
   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT CreateMenuBar(oDlg,oBrw1)
return nil
//---------------------------------  // 
Function CreateMenuBar(oDlg,oBrw)
local oMenu, oBar
local nWd := oBrw:nWidth(), nHt := oBrw:nHeight()

MENU oMenu 2007 
     MENUITEM "&First Option" ACTION Msginfo("Hi")
     MENUITEM "&Exit" ACTION oDlg:End()
ENDMENU
oDlg:SetMenu(oMenu)

DEFINE BUTTONBAR oBar 3D SIZE 30,30 OF oDlg 2007
DEFINE BUTTON RESOURCE "HI" OF oBar NOBORDER ;
   MESSAGE "Hi" ACTION Msginfo("My Action") TOOLTIP "My Tooltip"
DEFINE BUTTON RESOURCE "Exit" OF oBar NOBORDER ;
   MESSAGE "Hi" ACTION oDlg:End() TOOLTIP "Exit"
   SET MESSAGE OF oDlg TO "How are you?" 2007 // You must calculate this coordinates or  omit messages

oBrw:Move(oBar:nHeight()-1,0)
oBrw:SetSize(nWd, nHt-oBar:nBottom())

return nil
Regards.
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql

Continue the discussion