How to create a rails drop down menu which triggers either a text area or an upload form - ruby-on-rails

I would like to create a rails drop down menu, with two options: "Upload file" and "Write text". When "Upload file" is selected, an upload form will appear on the right hand site. When "Write text" is selected, an text area appears instead.
Thanks a lot!

Well there are many ways you could go about this, but I would just display the view as normal (but hide one of the elements to begin with) and attach a jquery event to the drop down menu. You can then show/hide the element within the event handler based on the value selected. Take a look at http://api.jquery.com/change/, http://api.jquery.com/hide/ and http://api.jquery.com/show/ to get started.

Related

Get the calling component of TPopupMenu

I have a TStringGrid, that has a TPopupMenu connected.
By clicking one event of the popup menu, I would like to get the calling component. Is that possible?
Background:
It is a bigger project, every form has a "BasicForm" I can inherited from. So I would like to provide a "default popup menu" for grids that have stuff like Copy, Select, and so on in it. In the inherited form I only match the grid (if exists) with that popup and I'm done.
Seems you are looking for the PopupComponent property of TPopupMenu:
Vcl.Menus.TPopupMenu.PopupComponent
Indicates the component that last displayed the popup menu in response
to a right mouse click.
Read PopupComponent to determine which control is currently using the
popup menu. In applications where multiple controls share the same
pop-up menu, use PopupComponent to determine which of them displayed
the menu.
Set PopupComponent to associate a control with the menu before calling
the Popup method programmatically to bring up the pop-up menu.

Adding multiple dropdown on clicking a link

I have a link which says "add another field". On clicking the link a dropdown should appear on top with let's say 5 custom fields as list in dropdown. Once user selects a field in that dropdown and clicks hyperlink another dropdown should appear below existing dropdown and with only 4 remaining fields as one is already selected.so how to start this?
https://tutorialslink.com/Articles/How-to-add-control-dynamically-in-Aspnet-MVC-using-Javascript/64 . I have tried to use this link which adds text boxes to get started.
I don't have any code expect for the code in above link which is for text box though. Just need an idea of how to do it in asp.net MvC as i cannot move forward now.
Expected results is to do the above requirement, don't have any actual results as of now

Can't find field to check or set UIButton tag--Xcode 5.0

I've got a number of buttons in a view and have assigned a tag number to each for identification in code. I just went back to check one of them, and can't find the field in the Attributes Inspector where I originally assigned the tags. I've tried all my buttons and restarted Xcode, and the result is the same--no tag field.
Here's what my attribute inspector looks like with a (tagged) button selected in the storyboard:
I came upon a recent comment by someone who also couldn't locate the tag field. He also is using Xcode 5.0.2.
Anybody else run into this?
Thanks!
The sections in the attributes inspector can be shown or hidden by clicking on the lines where the words "View", "Control", etc appear. When you rollover the line with these section titles, you'll see the words "show" or "hide" appear on the right edge of the line. Clicking anywhere on the line toggles between the two states.
Where it says view: Move your mouse over to the far right and something should appear that says "Show". Click on it and you'll see the tag identifiers, etc.

Combo box not focusable

Is there any way we can set the combo box not focusable? Because every time I select an item from combo box (drop down list), the keyboard shows up and the text from drop down list can be edited. I can't find any property from property inspector to disable this up. Or maybe we can disable this one programmatically in which I don't know.
Consider using an Option Menu (unlike a Combo Box an Option Menu has no field which a user can type into - and therefore no unwanted appearance of the keyboard)
Dave
The default script for a combo box is a menuPick handler. Whether or not you use the functionality of that handler or not, you would add this line at the end of that handler:

"Hello, world!" example for DevExpress QuantumGrid?

I successfully installed the latest QuantumGrid from DevExpress, but I've never worked with this grid before, and I don't know how to get started. I find that the HLP file isn't really a tutorial, and the demos are so rich to the point where I can't get started quickly and see if QuantumGrid fits my needs.
Would someone happen to have a really basic example on how to create a small, non-DB-bound, non-hierarchized, but user-editable grid to host a couple of columns and fill the grid with a few rows?
Thank you.
Place a grid on a form, then delete its default GridView and add a TableView. Add a few columns to TableView and then associate your GridLevel with this new view. Place a button on form and add this code to its click handler.
cxGrid1TableView1.DataController.BeginFullUpdate;
try
cxGrid1TableView1.DataController.RecordCount := 3;
cxGrid1TableView1.DataController.SetValue(0,0,'Data1');
cxGrid1TableView1.DataController.SetValue(1,0,'Data2');
cxGrid1TableView1.DataController.SetValue(2,0,'Data3');
finally
cxGrid1TableView1.DataController.EndFullUpdate;
end;
RecordIndex corresponds to the row index and ItemIndex corresponds to the column index. I hope this helps you to get started.
Create a table
view(gridlevel->create view->table)
Create columns(double click cxgrid
and add)
Set property(inner controls like
DateEdit) if you want. default
property is textedit)
You can insert/delete via
TableView.DataController.Insert/TableView.DataController.Delete*
or use navigator(View->OptionsView->Navigator)
You should look at demos("quantumgrid directory"\Demos\Delphi), demos are more helpful than help files :)
Thanks guys for the help. For those interested in getting started with this grid object, here (what I think) are the steps presented above:
(idursun)
Add a TcxGrid object to the form
In the Structure object in the IDE, right-click on cxGrid1, and select "Delete View"
Right-click on cxGrid1, and select "Editor"
Click on the "Views" tab, click on "Add View...", and select "Table" in the drop-down list
In the "Columns" tab on the right, click on "Add", and add a few columns
Still in this dialog box, go back to the "Structure" tab on the left
Right-click on cxGridLevel1, and choose "Select View" to associate the Level with this new TableView. Close the dialog
In the form, add a button, and paste this code to its Click event:
cxGrid1TableView1.DataController.BeginFullUpdate;
try
cxGrid1TableView1.DataController.RecordCount := 3;
cxGrid1TableView1.DataController.SetValue(0,0,'Data1');
cxGrid1TableView1.DataController.SetValue(1,0,'Data2');
cxGrid1TableView1.DataController.SetValue(2,0,'Data3');
finally
cxGrid1TableView1.DataController.EndFullUpdate;
end;
(barism)
Add a TxGrid object to the form
Within this new cxGrid1 object in the form, right-click its cxGrid1Level object, and select "Create View > Table"
In the Structure object in the IDE, right-click on cxGrid1, and select "Editor..."
In the Columns tab on the right, click on Add to add a couple of columns. Close this dialog
To add data to the grid, either write code, or right-click on cxGrid1 and select "Edit Layout and Data"

Resources