I am making calculator in oracle forms developer 11g
i want to show NUMBER in Result Display Box when button press (Button Label '1')
how to show number in display box?
That would be the WHEN-BUTTON-PRESSED trigger, obviously.
What isn't that obvious is what number you are talking about. Suppose that your "calculator" adds two numbers you enter into two form items. Then you'd use
:block.result := :block.number_1 + :block.number_2;
[EDIT]
Aha; I think I understand what you mean. There are 10 buttons, labeled 0, 1, 2, ..., 9 so you'd want to enter value behind that button into an item.
Option I suggested in a comment works, but - what if you want to enter two, three or more digits number? You'd have to concatenate them. That requires 10 WHEN-BUTTON-PRESSED triggers, each for one digit.
For example:
-- WHEN-BUTTON-PRESSED on a button labeled '1'
:block.display_box := :block.display_box || '1';
-- WHEN-BUTTON-PRESSED on a button labeled '2'
:block.display_box := :block.display_box || '2';
and so forth
Related
I want to create a button which, when pressed, adds a new input (or textarea) to the form.
If you want a text field to be added each time the button is clicked, that means that you want the number of displayed text fields to be equal to the number of times the button has been clicked. We can create a signal that tells us how often the button has been clicked by using the countIf id on the button's clicked signal¹.
If we have a list of inputs, we can use flow to display them beneath (or besides) each other. It is fairly straight forward to write a function that takes a number n and produces a list containing a button and n text fields.
So now we can just use lift to hook that function up to our signal that counts the number of button clicks, combine that with the flow function, and voilà, we have a button that dynamically creates inputs.
(btn, clicked) = Input.button "Click me!"
-- Count how often the clicked signal is true
clicks = countIf id clicked
main = lift2 flow (constant down) $ lift nInputs clicks
nInputs n =
let helper n acc =
if n<=0 then btn : acc
else
-- Input.textField returns a pair containing the field as well as a signal
-- that you can use to access the field's contents. Since I don't actually
-- ever do anything with the contents, I just ignore the signal here.
-- In your real code, you'd probably want to keep the signal around as well.
let (field, _) = Input.textField $ "input " ++ (show n)
in helper (n-1) $ field : acc
in helper n []
¹ Just using count would count how often the signal changes. Since each click causes the signal's value to change to true and then right back to false, that would count 2 changes per click. By using countIf id we only count the number of times the signal is true and thus the number of clicks.
As of Elm 0.8, this can indeed be done. See the release announcement, the Input Groups section of the online reference and a code example.
I'm trying to implement multiple record selection feature on a grid.
It is very similar to http://www.tek-tips.com/faqs.cfm?fid=3831
It adds an extra column with check boxes. I want those check boxes!!
But it depends on a extra logical field in the underlying table. It need to create a class clscheck which inherits CHECKBOX. I'm not sure why this CLICK procedure is needed for the checkbox.
PROCEDURE CLICK
IF DODEFAULT()
KEYBOARD '{DNARROW}'
ENDIF
ENDPROC
When I removed it, row selection did not work correctly as expected. Why this?
Here is my requirement:
1) I don't want to add an extra logical field in the underlying table.
2) To work with controls in the grid, I think AllowCellSelection must be .T. I want AllowCellSelection = .F. because I don't need to work with any control in the grid except the check boxes. I need to work only with check boxes. The other columns will be read-only.
3) Can I have selected list without the logical field in the underlying table?
4) Can I remove the usage of KEYBOARD '{DNARROW}'?
In fact, I have a grid which is AllowCellSelection = .F., but it only provides single selection.
I need to enhance it with multiple selection, thus, I just want to add an extra column with check boxes so that user can know he can select multiple records.
No need Shift+Click or Ctrl+Click which is not familiar with idiot users.
I have found this - http://www.tek-tips.com/faqs.cfm?fid=433
It also depends on an extra logical field and it depends Shift+Click and Ctrl+Click.
What you are seeing is quite common for multi-select grids. I've used them SIMILAR to this in the past. However, you are afraid of the extra column in the underlying table. That may/not be true. You don't always have to update the ORIGINAL table, but a temporary CURSOR you are presenting to the user. Ex: If you want to display a list of employees in a table. No, you don't want to keep adding this column to the original employee table as then anyone else trying to do multi-select could falsely get your selection. However, if you pulled into your own local cursor and presented to the user, then no problem. Example...
Thisform.YourGrid.RecordSource = "Employees"
(bound directly to your employee table -- not necessarily the right thing)
vs
use in select( "C_MultiPickEmployees" )
select ;
.F. as IsChosen, ;
E.* ;
from ;
Employees E;
into ;
cursor C_MultiPickEmployees READWRITE
Thisform.YourGrid.RecordSource = "C_MultiPickEmployees"
NOW, you have your extra column without dealing with issues to the underlying table. If you wanted to further filter what you were showing -- such as employees for a certain division/department, then just add that to a WHERE clause, add an Order By if so needed and you are good to go.
As for the "Allow Cell Selection", I've never had to deal with that. I just add a "checkbox" to the first column and set
Thisform.YourGrid.Column[1].CurrentControl = "CheckBoxControl"
(based on the name it is added to the column).
Then, set the column 1's "ControlSource" = "C_MultiPickEmployees.IsChosen" and you should mostly be done.
As for the "CLICK" event trying to force the down arrow. This is more for automatically scrolling to the next record so you can just click, click, click for multiple entries.
Hope this helps clarify things for you.
I am trying to create a column in a report which would take entries from a corresponding column from the database. This LOV is returning the active or inactive status depending on the value of the base column.
I would like to add colours to this column so it could be easier to spot records where the status has been set to inactive. So, green for active and red for inactive.
Any help greatly appreciated.
IR region source
select * from emp
Made an LOV on deptno
Run the report. Go to Actions > Format > Highlight
On the highlight options you can specify colours, whether to highlight the row or just a cell, and the condition for the highlight. Note that for lov columns you can pop open an lov with the values for that lov through the arrow button next to the expression field!
Applying this will result in this:
If you want this applied by default do not forget to save your report!
If highlighting is not to your satisfaction, you can still go the javascript / CSS way.
Create a dynamic action to fire after refresh of the IR region, with a true action of type Execute Javascript.
$("#apexir_DATA_PANEL td[headers='DEPTNO']").each(
function(){
if($(this).text()=='ACCOUNTING'){
$(this).addClass('deptAccounting'); //great to keep style in CSS!
$(this).css({"background-color":"red"}); //for that quick fix
}
}
);
Note that for this you need to specify the column (headers) and have to code in the to-be-compared text!
NewBee here. I am looking for a tutorial, article or sample code that details using first, last, next and previous buttons to display records from an SQLite database. Thanks in advance for your help, Jim
Look at the LIMIT and OFFSET clauses of SELECT:
http://www.sqlite.org/lang_select.html
All you need to do to build your pager device is to do a SELECT limiting to, say, 20 results, and supply an offset which is (page - 1) * 20. Your previous/next will decrement/increment your page number, and your first/last will set page to 1 or its maximum value respectively.
I've got a gridview with a list of categories. In the database (MSSQL2008), the category table has a SortOrder(INT) NULL field.
Currently categories are retrieved using:
Galleries.DataSource = From G In DB.GalleryCategories Order By G.SortOrder, G.Name
Now, what I need to be able to do is add "Move Up" and "Move Down" buttons to each row to allow the user to sort the items in an arbitrary way.
My initial thoughts are along the lines of:
Identify ID of selected item.
Identify ID of item before/after selected item.
Swap of identified items in the DB SortOrders.
I would then have make the sortorder NOT NULL and make sure it's initialised to a unique number
I'd appreciate any alternative suggestions / comments on this approach
Many thanks
I have generally seen it done this way, and have done it myself
SortOrder is an int
Each item increases by 10 (so, 10,20,30,40) or suitable increment
To move an item up, subtract 15
To move an item down, add 15
To insert an item, take the target and add/subtract 1
Apply a NormalizeSort() routine which resets the values to even intervals
10,20,25,30,40 => 10,20,30,40,50
That makes it all pretty simple, since inserting something above something else is just:
list.Add( New Item(..., target.SortOrder +1) )
list.NormalizeSort()
// or
item.SortOrder += 11, etc
If you want to make it a decimal, then you can just make it all sequential and just add .1, etc to the sort order and re-normalize again.
// Andrew
I believe
Galleries.AllowSorting = true;
would be far enough ;)