?
Solved

changing icons on the DBNavigator1

Posted on 2004-04-23
6
Medium Priority
?
542 Views
Last Modified: 2008-02-01
hi i have a DBNavigator1 and i would like to change icons on it
i have a resource file already and i am using
this code but id oen't work it doesn't even replace the basic icons with the caption nor the image s

dould anybody help


procedure TFrame1.FormActivate(Sender: TObject);
var c:
Integer;
begin
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.LoadFromResourceName(HInstance, 'ADD');

                          end;
            nbDelete : begin
                             Caption := 'Delete';
                             Glyph.LoadFromResourceName(HInstance, 'DELETE');
                            end;

            nbPost   :begin
                           Caption := 'Post';
                            Glyph.LoadFromResourceName(HInstance, 'POST');
                          end;
            nbCancel :begin
                            Caption := 'Remove';
                           Glyph.LoadFromResourceName(HInstance, 'REMOVE');
                           end;
            end;
         end;

end;
0
Comment
Question by:magma_george
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 10904077
Have you declared the resource file name ?

implementation
{$R Frame1.RES}  
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10904116

    create empty TXT file and save it as Frame1.rc
    write inside

    ADD             RT_BITMAP              Add.bmp
    DELETE        RT_BITMAP              Delete.bmp
    .....
    and so on..

    You Borland Command line resource compiles brcc32 found in Delphi/Bin folder

    type
           brcc32 -v Frame1.rc

    and you will have Frame1.res file in the directory.
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10904133

   Sorry, my mistake.... If your form is called Frame1 then name the RC file something else, for example DBNavButtons.rc and do the steps described above.

   Then after {$R Frame1.res} add {$R DBNavButtons.res}
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:magma_george
ID: 10904566
i did
what's next

0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10904579

  compile the code about

  procedure TFrame1.FormActivate(Sender: TObject);
  .....
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 2000 total points
ID: 10904947
They were not showing cause you didn't describe your DBImages.res file corectly, it fixed it for you and emailed it to you.

Also, because each button (generated at runtime) is assigned nil initially, you wont see anything on the Buttons until you get the Glyphs from the Resource file working properly.


Also, you needed to add the rest of your buttons to the runtime code.....

var I: Integer;
begin
with DBNavigator1 do
for I := 0 to ControlCount -1 do
 if Controls[I] is TNavButton then
  with TNavButton(Controls[I]) do
  begin
   Glyph := nil;
   Font.Style := [fsBold];
   Layout:= blGlyphTop;
   case TNavigateBtn(I) of

    nbInsert :begin
               Caption := 'Add';
               Glyph.LoadFromResourceName(HInstance, 'ADD');
              end;
    nbDelete : begin
                Caption := 'Delete';
                Glyph.LoadFromResourceName(HInstance, 'DELETE');
               end;

     nbPost   :begin
                Caption := 'Post';
                Glyph.LoadFromResourceName(HInstance, 'POST');
               end;
     nbCancel :begin
                Caption := 'Cancel';
                Glyph.LoadFromResourceName(HInstance, 'CANCEL');
               end;
     nbFirst :begin
               Caption := 'First';
               Glyph.LoadFromResourceName(HInstance, 'FIRST');
              end;
     nbLast :begin
               Caption := 'Last';
               Glyph.LoadFromResourceName(HInstance, 'LAST');
              end;
     nbNext :begin
               Caption := 'Next';
               Glyph.LoadFromResourceName(HInstance, 'NEXT');
              end;
     nbRefresh :begin
                       Caption := 'Next';
                       Glyph.LoadFromResourceName(HInstance, 'REFRESH');
              end;
     end;
  end;
end;


Shane
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

770 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