Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

changing icons on the DBNavigator1

Posted on 2004-04-23
6
Medium Priority
?
554 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
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

604 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