parent-child

Accessing Main Form From Child Form

Deadly 提交于 2019-11-29 07:39:49
I have a simple problem: I have a main form in win-forms/c#. It has a listbox bound to a database. When I click a button a new form is created. When I click a button on the child form, I want to call a method that exists in the main form, that updates the list box or alternatively when the child form closes, to call that function. Is this possible?? Scenario 1: Call a method in Parent Form on click of button in child form. Create an Event in Child Form. Raise that event on some Button Click etc. Subscribe to that event in your Parent Form and call the parent's form method inside that. Scenario

Closing child window from parent window

99封情书 提交于 2019-11-29 05:15:22
I cant figure out why this won't work. Is there something wrong with this code? The function is being called I checked with an alert but it just won't close the window. $('#click').click(function() { var win = window.open("test3.html","something","width=550,height=170"); }); function closeit(){ win.close(); } and on test3.html window.opener.closeit(); Your win variable is scoped to the function that handles the click event. Put it in a scope shared by both that function and closeit . In this case, that would probably look like: var win; … $('#click').click(function() { win = window.open("test3

Generics and Parent/Child architecture

为君一笑 提交于 2019-11-29 04:31:22
I'm building an architecture with inheritable generics and parent-children relations. I have one major problem: I can't make both the child and the parent aware of each other's type, only one of the two. I need both the child and the parent to be aware of each other's type. Scenario 1 : Parent knows child type, but child only knows generic parent with generic children. public class Child { public Parent<Child> Parent; } public class Parent<TChild> where TChild : Child { public List<TChild> Children; } Scenario 2 : Child knows parent type, but parent only knows generic children with generic

Generics and Parent/Child architecture

╄→尐↘猪︶ㄣ 提交于 2019-11-29 04:29:36
I'm building an architecture with inheritable generics and parent-children relations. I have one major problem: I can't make both the child and the parent aware of each other's type, only one of the two. I need both the child and the parent to be aware of each other's type. Scenario 1 : Parent knows child type, but child only knows generic parent with generic children. public class Child { public Parent<Child> Parent; } public class Parent<TChild> where TChild : Child { public List<TChild> Children; } Scenario 2 : Child knows parent type, but parent only knows generic children with generic

Use javascript to count immediate child elements of an element

ぐ巨炮叔叔 提交于 2019-11-29 04:09:31
I can get the count of all descendants of an element, but I can't seem to target just the immediate children. Here's what I have at the moment. var sectionCount = document.getElementById("window").getElementsByTagName("section").length; I've played with other stuff and different syntax, but I can't seem to get it. The jQuery equivalent would be: var sectionCount = $("#window > section").length; But I need to do this javascript only. Use the DOM selector interface ( querySelectorAll ). var selectionCount = document.querySelectorAll("#window > section").length; If you want a backwards compatible

Always use primitive object wrappers for JPA @Id instead of primitive type?

感情迁移 提交于 2019-11-29 02:54:25
问题 I've found the issue with using primitive type as an object @Id for JPA in conjunction with Spring Data JPA. I have parent/child relationship with Cascade.ALL on the parent side, and child has PK which at the same time is also parent's FK. class Parent { @Id private long id; @OneToOne(mappedBy = "parent", cascade = ALL) private Child child; } class Child { @Id @OneToOne private Parent parent; } So, when I run: ... Parent parent = new Parent(); Child child = new Child(parent); parent.setChild

How to set default child view with Angular UI Router

前提是你 提交于 2019-11-29 02:52:36
Let's say I have the following 3 Angular UI Router states: $stateProvider .state('adminCompanies', { abstract: true, url: "/admin/companies", template: '<div ui-view class="viewContainer" autoscroll="false" />' }) .state('adminCompanies.list', { url: "", templateUrl: 'app/admin/companies/companies.list.html', controller: 'AdminCompaniesController' }) .state('adminCompanies.detail', { url: "/:companyId", templateUrl: 'app/admin/companies/companies.detail.html', resolve: { company: function(Model, $stateParams) { return Model.get("/admin/companies", $stateParams.companyId); } }, controller:

Insert record in child table when parent record already exists using Entity Framework code first

天大地大妈咪最大 提交于 2019-11-29 02:28:58
I have some Parent records already inserted in the database. Now i want to add some child records. To do this I followed following steps: Retrieve the Parent(A) records Create a new child(B) record Add parent record to the Navigation property of Child. B.A = A Call SaveChanges. The problem is when i do this EF inserts a New Parent and then add the child with a foreign key pointing to new newly inserted parent instead of inserting just the child with mapping to already existing parent. I also checked the parent's primary key when saving the child and it does exists in the database. Note that i

get parent's view from a layout

拈花ヽ惹草 提交于 2019-11-28 23:36:32
问题 I have a FragmentActivity with this layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/menulabel" android:textSize="24sp" /> <EditText android:id="@+id/editText1" android

JavaScript mouseover/mouseout issue with child element

痞子三分冷 提交于 2019-11-28 21:36:50
I have this little problem and I am requesting for your help. I have a div element, inside which I have an img element, like this <div id="parent" onmouseover="MyFuncHover()" onmouseout="MyFuncOut()"> <img id="child" src="button.png" style="visibility: hidden" /> </div> <script type="text/javascript"> function MyFuncHover() { // Here I have some code that makes the "child" visible } function MyFuncOut() { // Here I have some code that makes the "child" invisible again } </script> As you, see, the image is a child of the div . I want that only when I leave the div , the child to disappear. Yet,