How to use mapWithIndex in Purescript? - purescript

I'm a naive at Purescript, so I have a very basic issue while working with one of Purescript based frameworks.
I'm using PrestoDOM and I wonder how to use mapWithIndex function from Data.Array package.
I tried like the following,
import Data.Array (mapWithIndex)
...
(mapWithIndex
(\(item index) -> // want to use both item and its index through loop
textView [
width MATCH_PARENT
, height WRAP_CONTENT
, text item
, visibility index > 0 ? VISIBLE : GONE
]
)
data
)
...
but I got this error:
Unable to parse module:
unexpected [
expecting indentation at column 1 or end of input
I know this error directly comes from my wrong use of mapWithIndex.

I could finally solve out the problem.
Wrong use of mapWithIndex - parameter order.
(mapWithIndex
(\index item ->
textView [
width MATCH_PARENT
, height WRAP_CONTENT
, text item
, visibility index > 0 ? VISIBLE : GONE
]
)
data
)

Related

How to use BarChartRodData of fl_chart

I want to make an app and I need to use fl_chart.
The question is: What do I do to make a space for each element evenly.
How can I do it like this screenshot?
Remove the property alignment from the BarChartData (Most probably it's set to center). It's going to use the spaceBetween instead as default.
It's going to be like the following:
BarChart(
BarChartData(
// Remove the `alignment` or change it to `spaceBetween`
alignment: BarChartAlignment.spaceBetween,
...
),
...
),
Also, if not already wrap BarChart with a Expanded widget.
Actually, you could set up "barsSpace" in the parameter of "BarChartGroupData".
Example from fl_chart
BarChartGroupData
PropName
Description
default value
x
x position of the group on horizontal axis
null
barRods
list of BarChartRodData that are a bar line
[]
barsSpace
the space between barRods of the group
2
showingTooltipIndicators
indexes of barRods to show the tooltip on top of them
[]

Ag-grid column grouping resize issue

In my developed grid with column grouping, there is white empty space is appear at end when resize the columns. Any Suggestion?[![enter image description here][1]][1]
You can call sizeColumnsToFit() after columnRowGroupChanged event:
columnRowGroupChanged A row group column was added or removed.
.html template event binding
(columnRowGroupChanged)="groupChanged($event)"
or .ts gridOptions event binding (don't forget to define [gridOptions] in .html)
this.gridOptions:{
onColumnRowGroupChanged : this.groupChanged.bind(this)
}
handling
groupChanged(params){
params.api.sizeColumnsToFit();
}
DEMO
Starting from ag-grid 23.1.0, we no longer have to use sizeColumnsToFit. Instead, in column definition, add flex: 1 to the last visible column.
This prevents all annoying jumps and weird grid behavior when resizing columns. In case user enlarge the column, horizontal scrollbar will appear, which is the expected behavior.
Please go over your code and change sizeColumnsToFit to the flex solution.
Flex also gives you control over relative column sizes, you can read more about it in the docs: https://www.ag-grid.com/javascript-grid-resizing/.
Example:
columnDefs = [{...}
...
{
headerName: 'HeaderA',
field: 'name',
...
flex: 1, // Adding this to last column definition
}]

how to set textfield size fix macos swift

I have one textfield "A" with width 150. but whenever I am passing more characters to textfield "A", it is getting overlapped on other textfield "B" characters.
I want textfield "A" to be fixed size and scrollable(mostly right and left).
Thanks in advance.
You should use Auto-Layeout in your storybook. Set fixed width, trailing space and leading space to your text field.
I have added the Auto-Layeouts to my textfields and I have followed below steps:
1) Selected the label.
2) Go to attributes inspector.
3) Select 'Line Breaks' and choose an option Truncate Tail
4) now I can see the text without overlapping with another textField.
Note: But still I am not able to view/Scoll the full text.
Just found this piece of code. It might help you
scrollView.hasHorizontalScroller = true
textView.maxSize = NSMakeSize(CGFloat(FLT_MAX), CGFloat(FLT_MAX))
textView.isHorizontallyResizable = true
textView.textContainer?.widthTracksTextView = false
textView.textContainer?.containerSize = NSMakeSize(CGFloat(FLT_MAX), CGFloat(FLT_MAX))

GtkLabel is not wrapping after updating its content

here is the code i am using :
messageCrypte= gtk_label_new("");
gtk_widget_set_size_request(messageCrypte, 400, 100);
gtk_label_set_line_wrap(GTK_LABEL(messageCrypte), TRUE);
gtk_grid_attach(GTK_GRID(cryptTab), messageCrypte, 0, ++i, 2, 1);
when i initialize the label manually by passing a string to the gtk_label_new , the text is wrapped ,
but when updating the GtkLabel , it increment the window size to the infinite without wrapping,
from the docs :
Note that setting line wrapping to TRUE does not make the label wrap
at its parent container’s width, because GTK+ widgets conceptually
can’t make their requisition depend on the parent container’s size.
For a label that wraps at a specific position, set the label’s width
using gtk_widget_set_size_request().
i did what it is said but no results !
the problem was in the wrap mode ,
the wrapd mode is '...WORD' by default that's mean it will wrap when :
(the limit is exceeded AND there is a new word)
but i was entering a string example that dont contains space so it will consider it a one word ,
but when setting the wrao mode to '...CHAR' it will wrap when :
(the limit is exceeded AND there is a new char) the 2nd condition is always verified ofcourse ,

How do i scroll a UITable view down until i see a cell with label "Value" in Calabash

How do i scroll a UITableView down until i see a cell with label "Value" in Calabash/Cucumber.
I've been trying to do it using:
Then I swipe down until I see "Value"
and using:
Then I scroll down until I see "Value"
but none of them seem to work. Thanks!
The message I get when I try with the above is obviously:
You can implement step definitions for undefined steps with these
snippets:
Then(/^I swipe down until I see "(.*?)"$/) do |arg1| pending #
express the regexp above with the code you wish you had end
add step definitions
Then /^I scroll to cell with "([^\"]*)" label$/ do |name|
wait_poll(:until_exists => "label text:'#{name}'", :timeout => 20) do
scroll("tableView", :down)
end
end
to the ProjectName/features/step_definitions/my_first_steps.rb ruby file and
In your calabash script add
Then I scroll to cell with "AAA" label
its working fine for me.
Every cucumber framework has a set of predefined steps. Of course, these steps don't cover all the possibilites. If you need additional functionality, you have to define your own steps:
When /^I scroll (up|down) until I see "([^\"]*)"$/ do |direction, something_to_see|
#implement the step here
end
I can't help you with the exact implementation (what is "Value"?) but you can find the core functions here
Probably you'll need function
scroll(uiquery, direction)
(where uiquery will be tableView)
If you take this function and element_is_not_hidden you can create a while cycle which will scroll down until you see the "Value".
Maybe something similar to the following (I don't know Calabash but I know Frank a little)
When /^I scroll (up|down) until I see "([^\"]*)"$/ do |direction, something_to_see|
max_scroll_tries = 10
[0..max_scroll_tries].each do
break if element_is_not_hidden("view marked:'#{something_to_see}'")
scroll("tableView", direction)
end
check_element_exists_and_is_visible("view marked:'#{something_to_see}'")
end
table have rows and sections, based how your code is organized use rows or sections in below code
def scroll_side_panel(text)
section=0
scroll_to_cell(:row => 0, :section => 0) # scroll to top of view
sleep 1 # wait for a second
#Scroll to each element and compare text, if there is a match break
each_cell(:animate => false, :post_scroll => 0.2) do |row, sec|
puts "#{query("tableViewCell indexPath:#{row},#{sec} label", :text)} #{text}"
if query("tableViewCell indexPath:#{row},#{sec} label", :text).first==text
break
end
section=section+1
end
puts "table view text found at element number:#{section}"
end
following should also work
Then(/^I scrolldown until "(.*?)" is visible$/) do |arg1|
until query("lable text:'#{arg1}'").length > 0
scroll("tableView", :down)
end
end
Call this by following
Then I scrolldown until "XY" is visible