ButtonBars for Dialog

ButtonBars for Dialog

Postby Ehab Samir Aziz » Fri Jan 13, 2006 11:30 pm

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
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby Antonio Linares » Sat Jan 14, 2006 12:54 am

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

Code: Select all  Expand view
   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
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Fri Aug 31, 2007 2:56 pm

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
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Fri Aug 31, 2007 4:16 pm

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
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Fri Aug 31, 2007 4:52 pm

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
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Fri Aug 31, 2007 5:19 pm

Otto,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 6 guests