Solved

DBNavigator1 editing the buttons

Posted on 2004-04-20
21
647 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

932 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

12 Experts available now in Live!

Get 1:1 Help Now