Button bar on dialog ?

Button bar on dialog ?

Postby TimStone » Wed Dec 12, 2007 9:38 pm

Hmmmm ....

I have only used one button bar on my main program. I was toying with the idea of putting button bars on some dialogs. The manual indicates you can do this, so if I try to add

DEFINE BUTTONBAR oBar OF oDlg SIZE 60,60 2007

it should work ???? Instead I get an error indicating it can't create the dialog ...

Is this no longer a valid option, or do I need to do something else in a dialog to get it to run ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Button bar on dialog ?

Postby Enrico Maria Giordano » Wed Dec 12, 2007 10:31 pm

You must create the buttonbar inside the ON INIT clause.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Strange

Postby TimStone » Wed Dec 12, 2007 10:48 pm

So the button bar, and the buttons, would need to go in the ON INIT statement when activating the dialog ? I just tried that with a COMMAND line and the compiler doesn't like that ...
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Button Bar

Postby Colin Haig » Thu Dec 13, 2007 12:54 am

Hi Tim

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT(AddBar(oData,oLbx,nNum,oStock));
VALID(WinOpen(oMainWnd,0),lExit)

static function AddBar(oData,oLbx,nNum,oStock)
local oBar,oBtn,oBtn1,oBtn2,oBtn3,cExitTip := '',cAddTip := '',cDelTip := '',cPrintTip := '',lRecs := FALSE
if nNum == 1
cExitTip := 'Exit Department Code Screen'
cAddTip := 'Add Department Code'
cPrintTip := 'Print Department Codes'
cDelTip := 'Delete Deparment Code'
elseif nNum == 2
cExitTip := 'Exit Timesheet Code Screen'
cAddTip := 'Add TimeSheet Code'
cPrintTip := 'Print Timesheet Codes'
cDelTip := 'Delete Timesheet Code'
elseif nNum == 3
cExitTip := 'Exit Stock Codes'
cAddTip := 'Add Stock Code'
cPrintTip := 'Print Stock Codes'
cDelTip := 'Delete Stock Code'
elseif nNum == 4
cExitTip := 'Exit Store Codes'
cAddTip := 'Add Store Code'
cPrintTip := 'Print Store Codes'
cDelTip := 'Delete Store Code'
elseif nNum == 5
cExitTip := 'Exit Tasks'
cAddTip := 'Add Task'
cPrintTip := 'Print Tasks'
cDelTip := 'Delete Task'
endif
if oData:reccount() > 0
lRecs := TRUE
endif

DEFINE BUTTONBAR oBar 3DLOOK SIZE 45, 45 OF oDlg 2007

DEFINE BUTTON oBtn of oBar RESOURCE "BTN_EXIT";
FLAT ;
PROMPT "Exit" ;
ACTION(lExit := TRUE,oDlg:End());
TOOLTIP(cExitTip)

DEFINE BUTTON oBtn1 of oBar RESOURCE "PLUS";
FLAT ;
PROMPT "Add" ;
ACTION(oData:Blank(),oData:append(),oLbx:Refresh(),oLbx:SetFocus(),oLbx:GoToCol(1));
TOOLTIP(cAddTip)

DEFINE BUTTON oBtn2 of oBar RESOURCE "PRINTER";
FLAT ;
PROMPT "Print" ;
ACTION(PrntCodes(oData,nNum),oLbx:Refresh(),oLbx:SetFocus());
TOOLTIP('Print Time Data')

DEFINE BUTTON oBtn3 of oBar RESOURCE "DELETE";
FLAT ;
PROMPT "Delete" ;
ACTION(lRecs := DelRec(lRecs,nNum,oData,oStock),if(lRecs,(oLbx:Refresh(),oLbx:SetFocus()),oLbx:Hide()));
TOOLTIP(cDelTip)
return(oBar)

HTH

Colin
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Example

Postby TimStone » Thu Dec 13, 2007 1:10 am

Thanks ... it makes sense now.

Of course that would add a lot of work for me ... but thats OK ... it makes it interesting.

I appreciate the guidance ... now I'll plug away at it !
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Postby James Bott » Thu Dec 13, 2007 8:22 am

Tim,

It's not hard, you can still use the command line, just inside a function called by the ON INIT.

James

Code: Select all  Expand view  RUN
   activate dialog oDlg on init buildBar(oDlg)
...
static function buildBar(oDlg)
   local oBar
   define buttonbar oBar of oDlg
   ...
return nil
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Not Hard

Postby TimStone » Thu Dec 13, 2007 3:28 pm

James,

No, its not hard ... I've already got it implemented in one dialog that was very important for the change. However, whats hard is going back through so many dialogs and deciding which ones operate better with dialogs and then making the changes ...

I guess hard is not the best word ... time consuming is more appropriate, especially when I need to go Christmas shopping ....

However, its working out ...

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 35 guests