How to replace an item in a listbox Lazarus - replace

My question is how do i replace an item in a listbox in Lazarus from a button procedure?
I know how to add and delete an item thats selected within the listbox but how do i remove the selected item and then add another item in the same place as the old one without changing its position in the listbox.
Example:
Bowl
Collar
Large pack of chews
Medium pack of chews
Pet grooming kit
Tick shampoo
Vitamin supplement
If i wanted to remove 'Collar' from the listbox and replace it with another item like 'Cat food' and have Cat food in the second index position.
Any help would be appreciated.

Assuming that you know that the index is 1 then you can replace that item's text with a simple assignment:
ListBox1.Items[1] := 'Cat food';

Related

How get display value of checkbox in a checkbox group?

I am using APEX 21.1. I have a checkbox group whose list of values is retrieved using a query...
select disease, id from history;
The query returns many checkboxes. I have another textarea item. I need to get the display value for any checkbox whenever it's checked and set item HISTORY to that value. How to do so?
Describing a how-to would be so much easier if you had provided some example page item names and example data. So, lets call your checkbox group P10_CHECKBOX and your textarea P10_TEXT.
Usually, your checkbox group will save the item ids as a colon seperated list, like this: 3:4:5
To display the corresponding display values, make a dynamic action on change on your item P10_CHECKBOX.
Then, use an action of type Execute PL/SQL Code to fetch the display values of your items.
The code could look like this:
select listagg(disease,chr(10)) within group (order by disease) into :P10_TEXT
from history h
join table(apex_string.split_numbers(:P10_CHECKBOX,':')) t on (h.id = t.column_value);
apex_string.split_numbers will convert your colon list into an actual "table" with the column column_value you can use in the join clause. listagg will do the actual concatenation and will work up to a couple thousand characters. chr(10) is an ordinary line break and will have your items be shown line by line, but any other seperator will do.
Last step is to set up P10_CHECKBOX in your Items to submit and P10_TEXT in your Items to return.
Now, whenever you click a checkbox, the textarea will be updated immediately.

Combobox with searchbox at the top

How to create a combobox with searchbox at the top? (https://learn.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.ComboBox?view=winrt-19041)
Combobox with searchbox at the top
As #Luca Lindholm said, you could set IsEditable as true that could make the input auto -complete. If you want to the dropdown will display the matched item dynamically, we suggest use AutoSuggestBox. And this is related tutorial.

How to pass data between fields in Oracle APEX 5.1?

This is a VERY basic question. Sorry for not providing any code I have NO IDEA how to even start tackling the problem
I have lets say two fields... One is a date selector field and the other a regular text field. What I want is when I select a date (or type a date), the value comes in the second field... Just that...
I'm on APEX 5.1.4
Since you have stated that the second item is a text field, you could do this with the help of a dynamic action that sets the value of the second item when there is a change in the value of the first item ( date field).
The following would be the steps, if you are using component view:
Create Dynamic Action
When
Event : Change
Selection : Item(s)
Item : First Page Item
Condition : is not null
True Action
Action : Set Value
Fire on Page Load: No
Set Type: You can choose how you want to set the value of the second item on the page.
If you have the flexibility to change the second item to be a select list and you have a list of values that goes with a date, you could do this much simpler, with a Cascading LOV
On Second Item's - Under List of Values section
Cascading LOV Parent Item(s) : First Item
Page Items to Submit: First Item
List of Values definition: Here you can define the query.
Hope this helps.
There are a few different ways to do this, probably the easiest way is as follows.
Assume your two items are P1_ITEM1 and P1_ITEM2.
Create a dynamic action which fires on change of item P1_ITEM1.
The true action of this should be action:set value, set type:PL/SQL Expression, item::P1_ITEM2, items to submit P1_ITEM1.

how to add checkbox control to the listcontrol subitems in mfc

I need to add checkbox control to the listcontrol subitems .First I will let you know what I did,Initially i added a listcontrol of report style and added checkbox style to the listview as follows.
m_MfpListControl.SetExtendedStyle(LVS_EX_CHECKBOXES);
This step of code is adding checkboxes to the first most column.But,I want to add checkbox to the subitems randomly like as,
Column1 | Column2 | Column3 | COlumn4
[]Item1 | []subitem1 | []subitem2 | [] subitem3
[]-Represents Checkbox
Adding for the "Item1" is not a big deal but adding to the subitems making me down and moreover I tried in manny ways like as after inserting item ,I am setting the state for the particular item as,
m_MfpListControl.SetItemState(0,INDEXTOSTATEIMAGEMASK(3),LVIS_STATEIMAGEMASK);
But this also didn't work fine ,as I am able to add and remove the checkbox for the first column ,I tried in a way of applying the same methodology like setting the item state as I had done using "SetItemState()" API in order to add the checkbox control to the subitems ,unfortunately it is not working in case of subitems.
Can anyone please let me know the right approach so that I should be able to add checkboxes to the subitems.
I use this class to add check boxes on subitems:
http://www.codeproject.com/Articles/8112/CQuickList
It requires LVS_OWNERDATA. In my case, it's not a problem.
This class also adds check boxes on subitems, but without LVS_OWNERDATA:
http://www.codeproject.com/Articles/29064/CGridListCtrlEx-Grid-Control-Based-on-CListCtrl
Vinicius

Is there any way to edit the pop-up comments dialog box for Workbox actions?

Right now, this dialog just says "Enter a comment:". I would like to edit this text or add some new text. Is this possible?
Switch to "core" database and navigate to /sitecore/system/Dictionary/E/Enter a comment item. In the Phrase field of this item place a string you'd like to see instead of default "Enter a comment:". Save the item - and try it out!
Update: BTW, the same technique is used for translations. If you switch to the Danish version of the item, you can see the Danish text in the Phrase field. If Phrase field is empty (like for English version of the item by default), the Key field is returned instead.