refresh a listview line item name - basic4android

I have a listview with some single line entries such as...
Sub MakeListView
ListView1.AddSingleLine("Empty1")
ListView1.AddSingleLine("Empty2")
ListView1.AddSingleLine("Empty3")
ViewPNL.AddView(ListView1, 0, 0, 100%x, 100%y)
End Sub
When the user does a long click on the listview entry, they can choose to load a file using the dialogue library. I have the file load working fine into fd.ChosenName.
I'm looking for a recommendation on how to update or refresh the listview entry to reflect the file name for the file that was loaded.
So if the list were to originally read:
Empty1
Empty2
Empty3
After loading files into the positions it may read for example:
Picture 1.Jpg
My Document.Doc
Sound File.mp3
I should also add that the user may not load a file into all 3 positions at the same time. So the list would need a refresh with each individual file load into the correct position.

Try writing a sub called updateList that clears the list and then rewrites everything. It is instantaneous. Call the sub when you create the activity and then again whenever a file is selected.
Sub updateList
ListView1.Clear
If filename <> "" Then
ListView1.AddSingleLine(filename)
Else
ListView1.AddSingleLine("Empty")
End If
End Sub

Related

LibreOffice BASIC function - Copy if over a value to a new sheet

I'm trying to create a simple function on a LibreOffice Calc sheet.
I have a table of information where cells A1:K2 has headings (the cells in Row 2 are merged)
all the information runs from A3:K176
The sheet has various functions running on it already, all I need is one more function.
At first I wanted it to automate when i open, but then i thought running the BASIC macro off of a button might be better, so i can edit and then just hit the button once I'm done.
I have the button linked up to run the macro already, but now im stuck... I have tried many ways of writing the code, but it seems that i am just too green to figure it out.
the last time i ran Excel advanced functions i was in high school.
ok, enough talking...
All I need the macro to do is once I hit the button, I need it to check column K and any value > 1 it needs to take that whole row and copy it then go to a target sheet, clear any data on the target sheet. then copy that set of rows to the next open row in the target sheet. possibly even exporting the result to a .txt file as a bonus.
this is a start...
in future I would like to add another button that will do the same function to a array lower down and put that into a different sheet.
Option Compatible
Sub SWD_AwakeningsTrade
Dim i, LastRow
LastRow = Sheets("Card_List").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Awakenings For trade").range("A2:I500").clearContents
For i=2 to LastRow
If Sheets("Card_List").Cells(i,"K").Value = "(>1)" Then
Sheets("Card_List").Cells(i, "K").EntireRow.Copy
Destination:=Sheets("Awakenings For trade").Range("A" & Rows.Count.end(xlUp)
End if
next i
End Sub

Excel stops working when adding new row to the Table

I don't know why but when I try to do this Excel Quits without saving anything:
On Sheet1 I have 11 Rows x 6 cols formatted as Table. With 1st row as Table Header.
I assign col A as a STU_ID Named Range using Name Manager.
I have only a listbox on the Userform. And I give RowSource property as =STU_ID . I get the col A data on the list box.
Now when I go to Sheet1 and try to add more data on next row of the table. Excel quits saying it has stopped working. Windows is checking for error and it restarts on a blank Workbook.
Shouldn't Listbox be dynamic and get data from Name Manager as I add them on the sheet ?
I am using MS Excel Pro 13 on Win 10 64 bit.
This is a bug in Excel. As a workaround, use the .List property instead of the .RowSource.
Try something like this in the UserForm's code:
Private Sub UserForm_Initialize()
ListBox1.List = Range("table1[abc]").Value
End Sub
This way it will be dynamic, and it will work.
If you need it to change while the userform is displayed, put a small code to the Sheet change event, that updates the list every time the sheet changes. (This is only necessary if your form is modal, and you want it to reflect the changes made in real-time.)

How can I show a specific record near the top in list view without screen flicker?

I have a script (in FileMaker 14) that sets a variable, $_record_number, to Get ( RecordNumber ) based on a specific criterion. Once it's been set, I want to bring that record to the top in list view. (It's possible that the criterion is never fulfilled and that $_record_number is empty.)
The portion of the script that does this looks like the following:
Go to Record/Request/Page [ Last ]
Refresh Window []
Go to Record/Request/Page [ No dialog ; Max ( $_record_number ; 1 ) ]
When the Refresh Window step isn't present, the script doesn't work correctly. Instead of bringing the record to the top of the list view, it brings it to the bottom.
Unfortunately, the Refresh Window step causes the window to flicker as the script redraws the layout.
Is there a way to duplicate the end results of the above steps without using Refresh Window and avoid the screen redraw?
Failed techniques I've tried:
Using Refresh Object instead of Refresh Window targeting objects in both the header and body
Using Go to Related Record with a relationship to the target record
If you're using FileMaker 13 or higher, you can try the Refresh Object script step instead of Refresh Window. See http://www.filemaker.com/help/13/fmp/en/html/scripts_ref2.37.62.html for more details on that specific step.
I've sometimes had issues refreshing portals without Refresh Window, but if you just need the text on a label or button to update when the variable does, it should work fine.
Chuck, one straightforward option would be to add an unstored calc field to your portal table, with a calc of Get(RecordNumber) = $_record_number. You could set the sort of your portal to reverse sort on this calc field. Since only the matching field should match, this should always pop the desired record (if any) to the top, and otherwise, this condition would be ignored.
Another option would be to manually step through your portal in a Loop and stop when you find a match.
Last, I'd wonder if it might be cleaner to store and test against your portal table's primary key instead of its record number, but that's of course beyond the scope of this question. Good luck :-)
I am in FM14, and I think this works: get rid of your lines that go to last record and refresh window and instead insert 'Scroll Window [ End ]', e.g.
Scroll Window [ End ]
Go to Record/Request/Page [ No dialog ; $recordNumber ]

Copy Data from Search results to another items from block in Oracle Forms Builder

Okay, I'm not sure if I can explain this well.
This is what it looks like at runtime:
The list of display items from above are the data that came from database query.
I put a 'When mouse click' trigger to every row so that when I click a row, it copies all the data to the field below. It works when I first try to click a row but when I click another row which supposed to change the data below, NOTHING HAPPENS anymore.
here is my canvas' variable names:
here is what's inside of the 'When mouse click' trigger:
thank you for the help!
Your mouse click code is not working because when you are clicking on search block then currently you are in that block so you should have to move to FLIGHT block before assigning the values also you have to move to next record to populate the values into new record otherwise it will rewrite the values on existing, below is the example given for your problem:
on mouse click add these lines before your code
Begin
Go_Block('flight');
loop
if flight.flight_id is null then
-- look for the empty record if found then exit and assign values
exit;
end if;
-- else continue finding empty record
next_record;
end loop;
end;
--- paste your mouse click trigger code below
I got it. This tiny line of code did the trick.
GO_ITEM(SYSTEM.MOUSE_RECORD);
it simply tells what row number the item you clicked inside the record is in. It gives a char value of zero '0' when you clicked an item outside the record.
For more uses of the SYSTEM variables, check this very useful link. Thanks!
http://oraclet.blogspot.com/2008/02/system-variables-toutorial.html

How can I keep a script from running if user isn't viewing records in FORM VIEW?

In Filemaker Pro 11, I've written a script that is script triggered to run on every instance of OnRecordLoad, however I don't want it to run when user is working in LIST or TABLE VIEWS.
Is there some code I can put at the beginning of my script that does something along the lines of this logic:
"If CURRENT VIEW does not = FORM VIEW then end script"
which would effectively end the script before it ran.
I'm new at working with FM and I can't figure out a way to check the current view status within a script. If that's not possible, is there a way to limit certain script triggers are enabled depending on which view (Form, List, or Table) the user is currently in?
Thanks for any help you can provide!
Use the Get(LayoutViewState) function (http://www.filemaker.com/12help/html/func_ref2.32.50.html)
If[ Get ( LayoutViewState ) = 0 ]
//They're in form view, do stuff
Else
//They're in list view or table view, skip
End If
You script should include the following lines right at the beginning:
If[Get(LayoutViewState)<>0]{
Exit Script[]
}
That basically ensures that the script will only run when the user's layout is in Form View.
Get(LayoutViewState) returns:
0 for form view,
1 for list mode
2 for Table view.
A similar function is Get(WindowMode) that returns:
0 for Browse mode
1 for Find mode
2 for Preview mode
Hope this helps.