Link to home
Start Free TrialLog in
Avatar of magma_george
magma_george

asked on

DBNavigator1 editing the buttons

hi

i have creaed a application with DBNavigator1 and database

but they come all together like > < stop and etc.

so now i need to put icons in  them but they are in in one pice so i need to separate them and
put isons in them

any body has any ideas

res:
i need to maintain their functionallity.


thank you
Avatar of shaneholmes
shaneholmes

You will need to create your images in a resource file (use Image Editor)

then use the following code to replace the Image or caption of the default buttons on the TDBNavigator:

with DBNavigator1 do
    for c := 0 to ControlCount -1 do
      if Controls[c] is TNavButton then
        with TNavButton(Controls[c]) do
        begin
          Glyph := nil;
          Font.Style := [fsBold];
          case TNavigateBtn(c) of
            nbInsert :begin
                           Caption := 'Add';
                           Glyph.LoadFromResource('ADD');
                          end;
            nbDelete : begin
                             Caption := 'Delete';
                             Glyph.LoadFromResource('DELETE');
                            end;

            nbPost   :begin
                           Caption := 'Post';
                            Glyph.LoadFromResource('POST');
                          end;
            nbCancel :begin
                            Caption := 'Cancel';
                           Glyph.LoadFromResource('CANCEL');  
                           end;
          end;
        end;

Let me know if you need help creating a resource file with your images

Shane
Avatar of magma_george

ASKER

well yes i would really need some help with the resource file if you
could ?

   create empty text file names DBNavButtons.rc and open it with notepad. Fill it.

  ADD                 RC_BITMAP              add.bmp
  DELETE            RC_BITMAP              delete.bmp
  ......
  (etc)

  Then from command line type : "brcc32 -v DBNavButtons". Brcc32 is the Borland resource compiler found in /bin folder in Delphi installation. It will produce DBNavButtons.res file

  The last step - put somewhere this
 
  {$R DBNavButtons.res}

 

  sorry my mistake - not RC_BITMAP - it is RT_BITMAP
Hello,

Another solution might be to just build it yourself, if you drop a panel and add the buttons you need loding glyphs yourself into them. All the functions in the dbnavigator are available in the database object, like table.next, table.forward, table.post etc. you could add if table.eof then disable next, last, if table.readonly disable insert, post, delete etc.

magma_george,

Open up notepad and add an entry for each image:

Example:

ADD        RC_BITMAP add.bmp
DELETE   RC_BITMAP delete.bmp
EDIT       RC_BITMAP Edit.bmp
POST      RC_BITMAP post.bmp
REFRESH RC_BITMAP refresh.bmp
FIRST     RC_BITMAP first.bmp
LAST     RC_BITMAP last.bmp
NEXT     RC_BITMAP next.bmp
PREV     RC_BITMAP prev.bmp

save the file as NAVImages.rc


then use the Borlands resource compiler (found in the \Bin directory) to compile the *.rc file into a resource file which you can compile into your application

Example

brcc32 C:\Progra~1\Borland\Delphi7\Projects\MyProject\NAVImages.rc

Then just add the resource to be compiled into your app as follows:

implementation

{$R *.dfm}
{$R NAVImages.res}


Hope this helps!

Shane
how do i compile that in the command line ?

click start button,

choose

Start/programs/accessories/command prompt

when the comman prompt window appears, type in

brcc32 <path to *.rc file>

Example:

brcc32 C:\Progra~1\Borland\Delphi7\Projects\MyProject\NAVImages.rc


Shane



is there any other way because brcc32 seems to be not working

i don't know why

it says


error couldn't open the  <path>

Post me your path to the *.rc file here so i can see the entire thing you have

Example:

brcc32 C:\Progra~1\Borland\Delphi7\Projects\MyProject\NAVImages.rc


Notice how I have

Program Files =  Progra~1


Shane
i could even send you my icons and the resource file so you could see


my path is C:\disp\icon

you can email them to me at holmesshane AT charter DOT net
HAVE YOU RECIVED ANYTHING

ZIPPED FOLDER
Not Yet!

Shane
not yet

let me send again

I got it!

Shane
K. i emailed you back the compiled version - however, this does not help you for the future.

I asked you to post me what you were using for the paths to compile- but you failed to do so.
How are you expecting to learn if we can't show you where your mistakes are?
Me compiling it for you doesnot help you in the future

Shane
BRCC32 C:\disp\icon

does not do it

you need the file name as well

Example

BRCC32 C:\disp\icon\DBImages.rc


Shane
ASKER CERTIFIED SOLUTION
Avatar of shaneholmes
shaneholmes

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
did you get it
i am not getting any e-mail from you