Kotlin RelativeLayout create button from point to point - kotlin

In the RelativeLayout, I added buttons with dates in order at top. I want to add states in a lower row. I align it to the bottom right with RelativeLayout.Below and RelativeLayout.RightOf, but I also want to extend the end point of the button until another date. When I specify the length, it extends to a different date on other devices, how can I solve this? as seen in the picture endpoint is 1031 but it extends to different dates on other devices. Thanks for helps.
I tried to do it by manually entering the button length, it didn't work. I want to fix the endpoint of the button to another button

Related

Change position and dimensions of submit button

How do I go about changing the position and dimensions of a submit button in smalltalk/squeak? This is what I have so far:
submitButton: aModel
^PluggableButtonSpec new
model: aModel;
label: 'submit';
action: #submitName;
yourself
When I open a window in squeak, the button is really small and positioned in the upper left-hand position (the default position I assume).
This is the way I would find out:
You are using the class PluggableButtonSpec. Browse that (select the word, cmd-B/ctrl-B). That is a class in the package ToolBuilder-Kernel. I notice that it is a subclass of PluggableWidgetSpec. That seems to offer some layout related methods, like frame, margin, minimumExtent, padding, horizontalResizing (the setter has as comment "#rigid, #spaceFill, #shrinkWrap") and verticalResizing.
Perhaps I can find some examples of how these are actually used? Select PluggableButtonMorph and type ctrl-shift-N to get the class refs (or use the right-click menu). Hmm, the only user is ToolBuilder>pluggableButtonSpec. If I then click on the senders button in the class refs window, I get a window showing the 20 senders of #pluggableButtonSpec.
The first one is probably a good example, as it shows how the button bar in the class pane of the code browser is build. It uses a panel with a horizontal layout of its children. Then it creates the three buttons, of which the one with '?' gets shrink wrapped (just enough space to fit). These get added to the panel with a spacer between them. The result is a panel where two buttons divide up the resulting space, a spacer and a small button.
The other ones show the use of different layout methods.

Adding drag and drop functionality to metro style app buttons with C# and XAML

I'm trying to implement a sort of drag functionality into my app. As a simplistic example imagine I have a 2x2 square of buttons, so four buttons total. Clicking a button will perform some other functionality however I want when they hold and drag one of these buttons for it to do something else (ideally if you drag one button and drop it while in the space of another button the two buttons will swap places, as long as I can get dragging and dropping working the swap should be easy).
I've done some research and followed a few tutorials but seemed to get errors at one step or another with all of those. It seems ListViews and GridViews have some drag and drop functionality in them already , but I had trouble properly arranging my buttons (there are many more than four and they are in very specific positions, like a diagram) inside these views, let alone getting drag and drop working with them.
How would I go about doing this? Ideally I could just tag these buttons as draggable, and then on a drag-drop event check for a drop position, then if the position is valid perform a swap method. I just can't seem to figure out how to make them draggable or how to have an event that checks a drop position.
Thanks.
Easy peasy, create a custom control that looks the way you want it to, set ManipulationMode to TranslateX|TranslateY, handle manipulation delta events to update positioning with something like a Canvas or TranslateTransform and when manipulation completes - either make it click or animate to the new position. From my experience - getting any other manipulations to work with a regular Button class just isn't working and since a button is a really simple control - it is easier to create your own than try to extend the existing one in such cases.

NSDatepicker buttons in graphical style

Anybody knows if it's possible to modify the date picker three little grey buttons (in its upper left corner) behavior?
I want the date picker displays the current day when clicking in the middle button (the circle one).
Any help will be appreciated. Thanks in advance.
Since NSDatePicker contains an NSDatePickerCell that handles most of the drawing and actions, the short answer is no, there's not an easy way to modify the behavior of the middle button.
However, I have discovered that option-clicking this button will jump to today. :-)

Creating a view for user to fill up a form

I'm creating a view which provides some fields for the user to fill in - address, phone number etc.
I've seen apps that have populated fields with grey text like 'Fill in your name here' on the Name field, and when the user taps on it the text is gone, a keyboard appears and the view is zoomed in to the textfield(or whatever it is). Also, after filling up that field tapping the 'Next' button on the keyboard brings the user to the next field. I'm trying to do the same but I have no idea where to get sources on this. Pardon my poor googling skills ;p
Tried UITextView and UITextField but there isn't anything related to this on the Interface Builder. Figured it lies with the codes?
It'd be great if I can get some explanation or some links on how this works (: Thanks!
EDIT: okay I played around with the Interface Builder a lil more and realized I could set placeholder as the grey text.
It is in fact a UITextField.
You can get the greyed out text by setting its placeholder property.
I am not sure what you mean by zooming but usually they do use a scroll view or adjust the frame so that it isn't blocked by the keyboard.
The Next button is made available using a UIToolbar instance as the text field's inputAccessoryView. However the implementation is one's own and is not framework provided. You can look at this example to get started.

How can I display a value in a textbox indicator and a slider in LabVIEW?

Is there a way to link two indicators on a LabVIEW front panel, so that they always have the same value? Right now I'm setting both to the same value every time, but it'd be much easier if there were a way to set up one to mirror the other.
You can make the digital display visible. Right-click on the slider and select "Digital Display" from Visible Items.
There are a few ways to achieve this, depending on how you are trying to display the data.
If you are just trying to update a slider and make a textbox indicator display the numeric value then by right clicking on the slider and selecting 'Visiable Items -> Digital Display' you will have a numeric indicator showing the value of the slider. This can then be repositioned as required. You should see if this meets your requirements as other methods will add complexity to your Block Diagram.
An alternate method would be using a network shared variable and binding the data although I think from your question this would be over kill.
You can also create an event structure to look for a value change event for the slider and update the text indicator accordingly. You would have to be careful how you update the slider as just wiring a value to the slider will not trigger an event for use a property node linked to the slider for the property 'value(signalling)'. Again this may be over the top for your application.
Strictly speaking, no, you can't do that automatically. What you can do is set up an Event Structure and use the Value Changed events for each of the two controls to update the other. Just realize that the slider fires value changed events many times while the user is sliding it around, rather than just one event at the end. That may be what you want in this situation, however.
I think this is not easily done, however there are some possibilities (as discussed).
The general question is why?
You have an indicator with the same info at two places. (or are they actual controls?)
If you have two indicators, just place there terminals next to each other, just remember when you alter one of the two (via a local or by ref) to mimic the action for it's twin.
Using a value change event for both controls should work, just remember that you might get race conditions if you don't process the event directly.
Could describe a little bit further why you need two controls for the same action/value?
Ton