Button bar on dialog ?

Post Reply
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Button bar on dialog ?

Post by TimStone »

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
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Strange

Post by TimStone »

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
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Colin Haig
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Button Bar

Post by Colin Haig »

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
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Example

Post by TimStone »

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
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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

   activate dialog oDlg on init buildBar(oDlg)
...
static function buildBar(oDlg)
   local oBar
   define buttonbar oBar of oDlg
   ...
return nil
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Not Hard

Post by TimStone »

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
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Post Reply