Solved

DBNavigator1 editing the buttons

Posted on 2004-04-20
21
645 Views
Last Modified: 2012-08-13
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
0
Comment
Question by:magma_george
  • 10
  • 8
  • 2
  • +1
21 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10873728
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
0
 

Author Comment

by:magma_george
ID: 10874924
well yes i would really need some help with the resource file if you
could ?
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10876650

   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}

 
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10876664

  sorry my mistake - not RC_BITMAP - it is RT_BITMAP
0
 
LVL 3

Expert Comment

by:Kunfufaresi
ID: 10876902
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.

0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10878426
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
0
 

Author Comment

by:magma_george
ID: 10883139
how do i compile that in the command line ?

0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10883168
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



0
 

Author Comment

by:magma_george
ID: 10883572
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>

0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10883597
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
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:magma_george
ID: 10883628
i could even send you my icons and the resource file so you could see


my path is C:\disp\icon

0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10883694
you can email them to me at holmesshane AT charter DOT net
0
 

Author Comment

by:magma_george
ID: 10883801
HAVE YOU RECIVED ANYTHING

ZIPPED FOLDER
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10883822
Not Yet!

Shane
0
 

Author Comment

by:magma_george
ID: 10883880
not yet

let me send again

0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10883900
I got it!

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10883924
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
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10884229
BRCC32 C:\disp\icon

does not do it

you need the file name as well

Example

BRCC32 C:\disp\icon\DBImages.rc


Shane
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 130 total points
ID: 10884238
Are you getting any of my emails, I keep getting email from you, but your not saying anything in them that makes me believe you are getting any of my email

Shane
0
 

Author Comment

by:magma_george
ID: 10885018
did you get it
0
 

Author Comment

by:magma_george
ID: 10896118
i am not getting any e-mail from you

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now