ButtonBars for Dialog

Post Reply
Ehab Samir Aziz
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

ButtonBars for Dialog

Post by Ehab Samir Aziz »

I can not find BottonBar functions well with Dialogs Only with Windows . Is this Right ? if So, It is written in NG :
Bar Commands
[ OF | WINDOW | DIALOG <oWnd> ] ;


function main()
local oBar
DEFINE DIALOG oDlg From 1,5 to 20,65 TITLE "FiveWin TWBrowse Power!!!"
DEFINE BUTTONBAR oBar size 20,20 of DIALOG oDlg
ACTIVATE DIALOG oDlg CENTERED
return nil
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

You can place a buttonbar at a dialog from the ON INIT clause of the dialog:

Code: Select all

   ACTIVATE DIALOG oDlg ;
      ON INIT PlaceButtonBar( oDlg )

...

function PlaceButtonBar( oDlg )

   local oBar

   DEFINE BUTTONBAR oBar size 20,20 of DIALOG oDlg 

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Hello Antonio,
is to declare OK as Static the best solution or is there an other way to end a DIALOG from a Bar?

BTW: in your example I think DIALOG too much
DEFINE BUTTONBAR oBar size 20,20 of DIALOG oDlg

DEFINE DIALOG oDlg From 1,5 to 20,65 TITLE "FiveWin TWBrowse Power!!!"
DEFINE BUTTONBAR oBar size 20,20 of DIALOG oDlg
ACTIVATE DIALOG oDlg ;
ON INIT PlaceButtonBar( oDlg )

if OK=.t.
...
endif

return nil
function PlaceButtonBar( oDlg )
local oBar

DEFINE BUTTONBAR oBar size 20,20 of oDlg

DEFINE BUTTON FILE ".\bitmaps2\E4.bmp" OF oBar ;
ACTION (OK:=.T.,oDlg:END()) ;
MESSAGE "Neuen Artikel eingeben"

return nil
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

You can delare Ok as local as pass it by reference:

ON INIT PlaceButtonBar( oDlg, @Ok )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

I tried by reference but with no success.

Regards
Otto


#INCLUDE "BOX.CH"
#INCLUDE "FILEIO.CH"
#INCLUDE "FIVEWIN.CH"
#INCLUDE "FOLDER.CH"
#INCLUDE "INKEY.CH"
#INCLUDE "REPORT.CH"



function Main()
LOCAL oWnd

DEFINE WINDOW oWnd from 1,1 TO 30,60 TITLE "TEST";
MENU bldMenu()
ACTIVATE WINDOW oWnd

return nil

function bldMenu()
LOCAL oMenu
MENU oMenu
MENUITEM "Start" ;
ACTION f_code()
ENDMENU

return oMenu

func f_code
LOCAL oDlg
LOCAL ok := .f.

DEFINE DIALOG oDlg From 1,5 to 20,65 TITLE "Test Dialog with Buttonbar"

ACTIVATE DIALOG oDlg ;
ON INIT PlaceButtonBar( oDlg ,@OK )

if OK=.t.
msgInfo("OK")
else
msgInfo("not OK")

endif

return nil

function PlaceButtonBar( oDlg , OK)
local oBar

DEFINE BUTTONBAR oBar size 20,20 of oDlg

DEFINE BUTTON FILE "E4.bmp" OF oBar ;
ACTION (OK:=.T.,oDlg:END()) ;
MESSAGE "Neuen Artikel eingeben"

return nil
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Otto,

It should work, if not, then declare it as static
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply