Re: Download Png Button Delphi

1 view
Skip to first unread message
Message has been deleted

Tanja Freeze

unread,
Jul 18, 2024, 1:11:18 AM7/18/24
to unsadepo

Basically what I want to do is this.I want a user to be able to add new text files via a button in my Delphi program itself. So if they press the 'Add' button in the program then a window would pop up with which the user would be able to select the specific text file wherever it may be stored. I'm then going to use that text file and display it.

I've done some research and it seems that using an openDialog component would be the best choice but I wasn't able to figure out how exactly to do this. I was also wondering if I'm going to use openDialog if there would be a way to save the text file added somewhere in the main delphi folder so that it wouldn't have to be added each time.

download png button delphi


Download File ->>->>->> https://ckonti.com/2yM5DW



I must have performed the search incorrectly because I did not find anything like this, so please point me to wherever I should be looking for answers to this question. I am a newbie to both Delphi\pascal and the forum.

Thanks Anders, I had tried adding BitBtn1.SetFocus; in various places but that didn't work either. Do you see a place for it in the code below? I get to this code by selecting the OK button and then going to code.

Since you are working with Delphi now. There's a lot to learn about how get Delphi to speak to the Oracle or least a database. One step is learning about TDataModule. They're used in some examples. The quote has a button click inside a double click which is inside a dialog. How about enabling controls when needed. Hiding buttons are bad, better to have disabled buttons as placeholders with hints what is needed first.

I tried inserting fChooseResult.showModal=mrCancel then fChooseResult.BitBtn1.SetFocus; as well as several other things and it either didn't work or it gave an error message: "Cannot focus a disabled or invisible window"

an error message: "Cannot focus a disabled or invisible window" clearly states what this is about. You need to make sure that the window where you want to target a component is visible and accessible. You don't have one of them (or both).
Only debugging (with Break point) will help here.

[*] Pumping the message queue means that the code loops, reading one message at a time from the message queue and dispatching these messages to the "message handlers". It's "a bit" more complicated than that but hopefully you get the overall picture.

I finally had to go to a developer in my company. The issue was that the modal dialog box was being created and destroyed in the same step. She had me create a procedure that creates the modal dialog box, set the focus, then close it and it worked. Thanks Anders!

Action lists let you centralize responses to user commands (actions) for objects such as menus and buttons that respond to those commands. See Handling VCL Actions Using an Action List for details on how to use action lists with buttons, toolbars, and menus.

I am currently writing a program where it gets to a point where it has to ask a question. I have created a group box which pops up, asking the question and giving a yes/no choice. the onclick event of the "yes" button sets a bool to true and the onclick of button "no" event sets the bool to false. The bool is set to false be default

The problem I have is that the program skips straight past the option of the bool being true as it doesnt give the user a chance to click a button. Is there a way that I can tell delphi to wait till either the yes or no button is pressed. Even a function that is already built into delphi 2005 would do the job, but it would need to have only yes/no buttons to respond.

seems like u are using one big procedure that include most of the program, right? that wolud be the troble. ur code must stop when u have to choose beetween yes and no. in yes.OnClick u write ur code for yes and in no.OnClick u write the code for no.... not just bool=true/false. programing in delphi is differet from pascal...
i hope i understood right ur problem and i gaved a right answer...

yeah, it is all part of 1 big procedure. What I am doing is like a supermarket till system. This question is for age checking, like alcohol etc, the question asks if the customer is old enough. The question is only brought up if the age restriction on the item is > than the currently logged customer age (gotten from asking the question before). This means that the question must come up in the procedure of adding the item to the bill, as each item could have a different age restriction on it. So I dont think its possible to seperate it out into the yes/no button code

than u need a nother button in the end of the list of the questions. so the user will press that button after answering all the questions. u contionue the code in that button. u will not a boolean variable for each question...or an integer variable that could be -1 initial and 0/1 after user will answer the question(so u can check if the user answered that question or skip it)

Unlike TButton and TBitBtn controls, TSpeedButton does not capture the "tab focus," which means when you click on a speed button, your focus will not move -- making TSpeedButton ideal to implement hot keys/buttons.

As I understand, you have a panel with some buttons?
Let's name this panel Panel1.Drop on Panel1 another TPanel (Panel2) and place buttons on Panel2.
Now you can center Panel2 and dont worry about buttons.Anthony Servito wrote in message ...

An icon button is a graphical control element that allows users to interact with a software application. It typically consists of an icon or image that represents a specific action, command, or task. Icon buttons are commonly used in user interfaces to provide visual cues for common actions, such as opening a file or saving a document. They can also be used to provide quick access to frequently used commands or tools. In many cases, icon buttons are more intuitive and efficient than traditional text-based menu items or toolbar buttons. As a result, they are often used in conjunction with other elements, such as drop-down menus and context menus.

All educational and instructional content on this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Please reuse it in learning and teaching programming with Delphi.

This tutorial is intended for Delphi beginners who have a somewhat steady knowledge of both the components and simple coding within Delphi. Basic processes like naming objects will not be fully described. Programming a calculator is a great way to begin learning any programming language. It offers a practical project that includes many (but not too many) elements of the language. This is just one way you could code a calculator in Delphi. There are probably many ways to this, and I fully challenge you to find new and creative methods of doing such. This specific calculator will be able to handle four mathematical functions with two numbers. Let's begin.

So the first thing we should do is open Delphi (I will be using Delphi 5, but this tutorial will likely be compatible with most versions of Delphi.) You will be presented with a new project titled "Project 1." The project includes three detached windows: the Object Inspector, the unit windo, and the form. Now let's build the design for the calculator.

NOTE: You will be unable to just copy and paste source code as we go along unless you name your objects the same as mine. A list of the objects used and their names are listed towards the bottom of the page. The entire source code is also provided at the bottom of the page.

For this calculator, we will be using buttons, labels, edit boxes, and panels from the component palette. All of these components are found in the "Standard" tab of the component palette. We will want an edit box at the very top of the calculator,buttons to add numbers to this edit box, buttons to signify certain mathematical functions, a label to display our answer. You should arrange these components in any way that appeals to you, but I will offer my design for you to follow. My design can be seen to the right.

You can change what is displayed on the buttons and label by clicking on an individual button or the label and going to the Object Inspector. You will see a list of paramaters and one will be called "Caption." Click on the white panel directly right of the Caption box and type in the caption you would like to see displayed. You can also change the font displayed by the buttons by changing the many options listed under the "Font" parameter or by simply selecting the white edit box right o the Font box and clicking on the small button that is labeled "..." This should bring up a font palette that will make adjusting the font much easier. You can change the font to both the label and edit box in this way, also. To change the text in the edit box, you will need to adjust the "Text" parameter. I have mine blank, and I suggest you do the same.

Let's go ahead and compile and test our "calculator." Do this by pressing F9 or selecting Run>Run. As you can see it looks like what we built, but it is completely useless as far as being a calculator. That's where the coding comes in.

We will start with the most basic coding involved with this calculator: the number buttons. Their sole purpose is to make the numbers that appear on their surface to also appear in the edit box. Before we begin, let's thoroughly plan what we want to occur when each button is pressed. We want the number to be placed into the edit box behind any numbers that already exist in the edit box. We will create a subroutine that can be called by every button when it is clicked. Creating user-generated subroutines is slightly harder than creating a regular object event, but they often lead to cleaner, more condensed code. Bring up the Unit (the window with the coding). Directly after the word implementation, begin writing your procedure. To do this, begin with the word "procedure" followed by " T(**Name of your form**).(**Name of event**) " followed by " (Sender : TObject); " You can now add code similiar to what I have shown below and read the explanation to make sure you fully understand what is happening in the code. Immediately after the code explanation, I will give you two more steps in implementing this subroutine into every number button and the decimal button.

7fc3f7cf58
Reply all
Reply to author
Forward
0 new messages