Page 1 of 1
ButtonBars for Dialog
Posted: Fri Jan 13, 2006 11:30 pm
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
Posted: Sat Jan 14, 2006 12:54 am
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
Posted: Fri Aug 31, 2007 2:56 pm
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
Posted: Fri Aug 31, 2007 4:16 pm
by Antonio Linares
You can delare Ok as local as pass it by reference:
ON INIT PlaceButtonBar( oDlg, @Ok )
Posted: Fri Aug 31, 2007 4:52 pm
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
Posted: Fri Aug 31, 2007 5:19 pm
by Antonio Linares
Otto,
It should work, if not, then declare it as static