Sample Program Toolbar2.prg is NOT working in other App

Sample Program Toolbar2.prg is NOT working in other App

Postby shri_fwh » Wed Jun 12, 2019 4:42 am

Dera All ,

I have compiled the Sample Program toolbar2.prg and it is successfully compiled and executed as well. But when I copy all source code of toolbar2.prg as it is in my app and compiled it. But It is neither showing any Toobar nor Button of the Toolbar. I have compared all libs buildh.bat and mine script both found identical. I am not sure what is wrong in my app. Could you please help me on this. Thanks in advance...!

Thanks
Shridhar
Last edited by shri_fwh on Wed Jun 12, 2019 8:00 am, edited 1 time in total.
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: Sample Program Toobar2.prg is NOT working in other App

Postby nageswaragunupudi » Wed Jun 12, 2019 5:02 am

Can you prepare a sample and post here?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Sample Program Toolbar2.prg is NOT working in other App

Postby shri_fwh » Fri Jun 14, 2019 4:27 am

Dear Rao Sir ,

Attached below code for the same.
App.prg
Code: Select all  Expand view

#include "FiveWin.ch"

REQUEST DBFCDX, DESCEND

PROCEDURE Main
   

    RDDSETDEFAULT( "DBFCDX" )
         
    AppToolBar()
   
   

return

 


Toolbar2.prg
Code: Select all  Expand view

// Win32 TReBar and TToolBar sample

#include "FiveWin.ch"

function AppToolBar

   local oWnd, oReBar, oToolBar1, oToolBar2, oImgList1, oImgList2

   DEFINE WINDOW oWnd TITLE "FWH - Testing Win32 ReBars & Toolbars" ;
      MENU BuildMenu()

   // First we build the imagelists with all the bitmaps
   DEFINE IMAGELIST oImgList1 SIZE 32, 32

   DEFINE IMGBITMAP OF oImgList1 NAME "new"    COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImgList1 NAME "open"   COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImgList1 NAME "search" COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImgList1 NAME "print"  COLOR nRGB( 255, 0, 255 )
   
   DEFINE IMAGELIST oImgList2 SIZE 32, 32
   
   DEFINE IMGBITMAP OF oImgList2 NAME "internet" COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImgList2 NAME "keys"     COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImgList2 NAME "quit"     COLOR nRGB( 255, 0, 255 )

   // Now we create the rebar
   DEFINE REBAR oReBar OF oWnd

   // Now we create the toolbars and add the buttons
   DEFINE TOOLBAR oToolBar1 OF oReBar SIZE 50, 58 ;
      IMAGELIST oImgList1
   
   DEFINE TBBUTTON OF oToolBar1 ;
      ACTION  MsgInfo( "New" ) ;
      TOOLTIP "New" ;
      PROMPT  "&New project"

   DEFINE TBBUTTON OF oToolBar1 ;
      ACTION  MsgInfo( "Open" ) ;
      TOOLTIP "Open" ;
      PROMPT  "Open project"

   DEFINE TBSEPARATOR OF oToolBar1

   DEFINE TBMENU OF oToolBar1 ;
      ACTION  MsgInfo( "Search" ) ;
      TOOLTIP "Search" ;
      PROMPT  "Search" ;
      MENU    BuildPopup()

   DEFINE TBBUTTON OF oToolBar1 ;
      ACTION  MsgInfo( "Print" ) ;
      TOOLTIP "Print a report" ;
      PROMPT  "Print a report"

   DEFINE TOOLBAR oToolBar2 OF oReBar SIZE 50, 50 ;
      IMAGELIST oImgList2

   DEFINE TBBUTTON OF oToolBar2 ;
      ACTION  MsgInfo( "Upgrade" ) ;
      TOOLTIP "Search for new versions" ;
      PROMPT  "Upgrade Ver."

   DEFINE TBBUTTON OF oToolBar2 ;
      ACTION MsgInfo( "Users" ) ;
      TOOLTIP "Users management" ;
      PROMPT "Users"  

   DEFINE TBSEPARATOR OF oToolBar2

   DEFINE TBBUTTON OF oToolBar2 ;
      ACTION  oWnd:End() ;
      TOOLTIP "End Application" ;
      PROMPT  "Exit"

   // We set the widths for each toolbar
   oToolBar1:nWidth = 300
   oToolBar2:nWidth = 300

   // Now we insert the toolbars into the rebar
   oReBar:InsertBand( oToolBar1 )
   oReBar:InsertBand( oToolBar2 )

   DEFINE STATUSBAR OF oWnd PROMPT "Rebars and Toolbars test"

   ACTIVATE WINDOW oWnd MAXIMIZED
   
   oImgList1:End()
   oImgList2:End()

return nil

function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM "&Project"
      MENU
         MENUITEM "&New..." ACTION MsgInfo( "New" )
         MENUITEM "&Open..." ACTION MsgInfo( "Open" )
         SEPARATOR
         MENUITEM "&Exit..." ACTION MsgInfo( "End" )
      ENDMENU

      MENUITEM "&Edit"
      MENU
         MENUITEM "&Search..." ACTION MsgInfo( "Search" )
         MENUITEM "&Print..." ACTION MsgInfo( "Print" )
      ENDMENU

      MENUITEM "&Utilities"
      MENU
         MENUITEM "&Upgrade..." ACTION MsgInfo( "Upgrade" )
         MENUITEM "&Users..." ACTION MsgInfo( "Users" )
      ENDMENU
   ENDMENU

return oMenu

function BuildPopup()

   local oMenu
   
   MENU oMenu POPUP
      MENUITEM "One"   ACTION MsgInfo( "One" )
      MENUITEM "Two"   ACTION MsgInfo( "Two" )
      MENUITEM "Three" ACTION MsgInfo( "Three" )
   ENDMENU
   
return oMenu      

procedure AppSys  // Xbase++ requirement

return

 


build.bat
Code: Select all  Expand view

@echo off
cls
set FWDIR=C:\VIMDEV32\DEV32\fwh32
set HBDIR=C:\VIMDEV32\DEV32\HarbourBCC7
set BCCDIR=C:\VIMDEV32\DEV32\BCC73
set PRJHOMEDIR=C:\VIMDEV32\FWHTEST
set PRGDIR=%PRJHOMEDIR%\PRGS
set OBJDIR=%PRJHOMEDIR%\OBJ
set APPNAME=%PRJHOMEDIR%\vimfa

set LNKFILE=APPLINK.bc
@cls
echo Building....!
:CLEAN
del %OBJDIR%\*.c
del %OBJDIR%\*.obj
del %PRJHOMEDIR%\*.exe
del %PRJHOMEDIR%\*.map

for %%f in (%PRGDIR%\*.prg) do %HBDIR%\bin\harbour %%~f  /n /i%FWDIR%\include;%HBDIR%\include;%PRJHOMEDIR%\INCLUDE /w1/es1 /p -o%OBJDIR%\
rem C:\VIMDEV\HarbourBCC64\bin\harbour Noname /iC:\VIMDEV\HarbourBCC64\include;C:\fwh64\include /n /w                                                                                                                                                                                                                                                                                                                                 -oC:\VIMDEV\P\C\ > C:\VIMDEV\p\c\comp1.log 2> C:\VIMDEV\p\c\comp2.log

@echo Harbour Compiler Processing....!

for %%f in (%OBJDIR%\*.c) do %BCCDIR%\bin\bcc32 -c -I%HBDIR%\include -I%BCCDIR%\include\dinkumware -I%BCCDIR%\include\windows\sdk -I%BCCDIR%\include\windows\crtl -I%BCCDIR%\include\windows\rtl -o %OBJDIR%\%%~nf.obj %%~f
REM @cls

for %%f in (%PRJHOMEDIR%\RES\*.rc) do %BCCDIR%\bin\brc32 -r -I%BCCDIR%\include -I%BCCDIR%\include\windows\sdk -I%BCCDIR%\include\windows\crtl %OBJDIR%\%%~nf
rem @pause
REM for %%f in (%OBJDIR%\*.rc) do echo %OBJDIR%\%%~nf %%~f
REM @pause
rem if EXIST %1.rc %bcdir%\bin\brc32 -r -D__64__ -I%bcdir%\include -I%bcdir%\include\windows\sdk %1
rem %BCCDIR%\bin\brc32 -r -D__64__ -I%BCCDIR%\include -I%BCCDIR%\include\windows\sdk %1
@del %PRGDIR%\*.ppo


echo %BCCDIR%\lib\c0w32.obj + > %LNKFILE%
for %%f in (%OBJDIR%\*.obj) do echo %%~f  + >> %LNKFILE%

echo , + >> %LNKFILE%
echo %APPNAME%.exe , + >> %LNKFILE%
echo %APPNAME%.map , + >> %LNKFILE%

echo %FWDIR%\lib\fiveh.lib %FWDIR%\lib\fivehc.lib %FWDIR%\lib\libcurl.lib %FWDIR%\lib\libmariadb.lib + >> %LNKFILE%

echo %HBDIR%\LIB\hbwin.lib    + >> %LNKFILE%    
echo %HBDIR%\LIB\gtgui.lib    + >> %LNKFILE%    
echo %HBDIR%\LIB\hbrtl.lib    + >> %LNKFILE%    
echo %HBDIR%\LIB\hbvm.lib     + >> %LNKFILE%    
echo %HBDIR%\LIB\hblang.lib   + >> %LNKFILE%    
echo %HBDIR%\LIB\hbmacro.lib  + >> %LNKFILE%    
echo %HBDIR%\LIB\hbrdd.lib    + >> %LNKFILE%    
echo %HBDIR%\LIB\rddntx.lib   + >> %LNKFILE%    
echo %HBDIR%\LIB\rddcdx.lib   + >> %LNKFILE%    
echo %HBDIR%\LIB\rddfpt.lib   + >> %LNKFILE%    
echo %HBDIR%\LIB\hbsix.lib    + >> %LNKFILE%    
echo %HBDIR%\LIB\hbdebug.lib  + >> %LNKFILE%    
echo %HBDIR%\LIB\hbcommon.lib + >> %LNKFILE%    
echo %HBDIR%\LIB\hbpp.lib     + >> %LNKFILE%    
echo %HBDIR%\LIB\hbcpage.lib  + >> %LNKFILE%    
echo %HBDIR%\LIB\hbcplr.lib   + >> %LNKFILE%    
echo %HBDIR%\LIB\hbct.lib     + >> %LNKFILE%    
echo %HBDIR%\LIB\hbpcre.lib   + >> %LNKFILE%    
echo %HBDIR%\LIB\xhb.lib      + >> %LNKFILE%    
echo %HBDIR%\LIB\hbziparc.lib + >> %LNKFILE%    
echo %HBDIR%\LIB\hbmzip.lib   + >> %LNKFILE%    
echo %HBDIR%\LIB\hbzlib.lib   + >> %LNKFILE%    
echo %HBDIR%\LIB\minizip.lib  + >> %LNKFILE%    
echo %HBDIR%\LIB\png.lib      + >> %LNKFILE%    
echo %HBDIR%\LIB\hbcurl.lib   + >> %LNKFILE%    
echo %HBDIR%\LIB\hbusrrdd.lib + >> %LNKFILE%    
echo %HBDIR%\LIB\hbtip.lib    + >> %LNKFILE%    
echo %HBDIR%\LIB\hbmxml.lib   + >> %LNKFILE%
echo %HBDIR%\LIB\hbmisc.lib   + >> %LNKFILE%
echo %BCCDIR%\lib\cw32.lib          + >> %LNKFILE%
echo %BCCDIR%\lib\uuid.lib          + >> %LNKFILE%
echo %BCCDIR%\lib\import32.lib      + >> %LNKFILE%
echo %BCCDIR%\lib\psdk\odbc32.lib   + >> %LNKFILE%
echo %BCCDIR%\lib\psdk\nddeapi.lib  + >> %LNKFILE%
echo %BCCDIR%\lib\psdk\Iphlpapi.lib + >> %LNKFILE%
echo %BCCDIR%\lib\psdk\msimg32.lib  + >> %LNKFILE%
echo %BCCDIR%\lib\psdk\psapi.lib    + >> %LNKFILE%
echo %BCCDIR%\lib\psdk\rasapi32.lib + >> %LNKFILE%
echo %BCCDIR%\lib\psdk\gdiplus.lib  + >> %LNKFILE%
echo %BCCDIR%\lib\psdk\riched20.lib + >> %LNKFILE%
echo %BCCDIR%\lib\psdk\shell32.lib  + >> %LNKFILE%
echo %BCCDIR%\lib\psdk\urlmon.lib,    >> %LNKFILE%

for %%f in (%OBJDIR%\*.res) do echo %%~f  + >> %LNKFILE%

%BCCDIR%\bin\ilink32 -Gn -aa -Tpe -s @%LNKFILE%



%APPNAME%

 


Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: Sample Program Toolbar2.prg is NOT working in other App

Postby ukoenig » Mon Jun 17, 2019 10:24 am

Is that the situation do You mean :
a mainwindow with a toolbar or something else, calling a dialog on selection with a defined TREBAR
( using toolbar2.prg but defined as a dialog ) :?:

During testing I noticed a problem : including this sample in the FWH-sample-folder it works.
The same created as a extra test doesn't work ( the exe is created / copied from the FWH-sample-folder ).
If TREBAR is disabled the toolbars are visible otherwise nothing.
For the moment I couldn't find out why TREBAR doesn't work outside the FWH-sample-folder
Just try by yourself

Download
( rename and copy to the FWH-sample-folder )

http://www.pflegeplus.com/DOWNLOADS/NToolbar2.zip

Image

regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Sample Program Toolbar2.prg is NOT working in other App

Postby shri_fwh » Mon Jun 17, 2019 3:37 pm

Hi Uwe ,

Thank you ...! I will try this code.

I was looking also BUTTONBAR instead of TOOLBAR in the BUTTON BAR I did not find the property like oToolBar1:nWidth = 300. Please correct me if I am wrong.

Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: Sample Program Toolbar2.prg is NOT working in other App

Postby nageswaragunupudi » Mon Jun 17, 2019 3:58 pm

Buttonbar always extends from left to right full (or top to bottom if the bar is vertical).
But why do you need to restrict the width of the buttonbar? It looks awkward.
If you explain what is it you want to achieve, we can help you.

Do you want some buttons aligned to the left and a few buttons aligned to right?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Sample Program Toolbar2.prg is NOT working in other App

Postby shri_fwh » Tue Jun 18, 2019 4:54 am

Dear Sir ,

Yes...! I want to align button either left or right. I have two button BARs for the First Button BAR I want to see all buttons LEFT to RIGHT and in Second Button BAR all button RIGHT to LEFT.

Can you please guide on this..! Thanks in advance...!


Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: Sample Program Toolbar2.prg is NOT working in other App

Postby nageswaragunupudi » Tue Jun 18, 2019 6:05 am

Please try this sample:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oWnd, oBar

   DEFINE WINDOW oWnd TITLE FWVERSION

   DEFINE BUTTONBAR oBar OF oWnd SIZE 64,64 2007  HEIGHT 90 // Use height clause only if using Group Labels

   // Left aligned buttons (default)
   DEFINE BUTTON OF oBar PROMPT "New"  RESOURCE FWBitmap( "new16" )  GROUP LABEL "EDIT" COLORS CLR_WHITE,CLR_GREEN
   DEFINE BUTTON OF oBar PROMPT "Edit" FILE "c:\fwh\bitmaps\edit.bmp"
   DEFINE BUTTON OF oBar PROMPT "Delete" FILE "c:\fwh\bitmaps\16X16\delete2.bmp"
   DEFINE BUTTON OF oBar PROMPT "Excel" RESOURCE FWBitmap( "excel" ) GROUP LABEL "EXPORT" COLORS CLR_WHITE,CLR_BLUE
   DEFINE BUTTON OF oBar PROMPT "Print" RESOURCE FWBitmap( "printer" )

   // Right aligned buttons: Use BTNRIGHT clause
   DEFINE BUTTON OF oBar PROMPT "Info" FILE "c:\fwh\bitmaps\info.bmp" BTNRIGHT GROUP
   DEFINE BUTTON OF oBar PROMPT "Help" FILE "c:\fwh\bitmaps\help.bmp" BTNRIGHT GROUP
   DEFINE BUTTON OF oBar PROMPT "Exit" RESOURCE FWBitmap( "exit2" )   BTNRIGHT

   oWnd:nWidth := 800

   ACTIVATE WINDOW oWnd CENTERED

return nil
 

Demonstrates:
1. Aligning some buttons to the right.
2. Grouping of buttons
3. Labeling of groups

Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Sample Program Toolbar2.prg is NOT working in other App

Postby shri_fwh » Tue Jun 18, 2019 8:21 am

Dear Sir ,

Thanks a lot for this support.


Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Marc Venken, Silvio.Falconi and 112 guests