-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subModelWin issue passing a parameter #555
Comments
If you provide a link to a GitHub repo containing a minimal working example, then I can show you how I would handle this. |
let me see what I can do @TysonMN . Probably will cost me a day, but I will mention you when I finished it. |
@TysonMN I have send you a invite for the project and reproduced it to the most simplified version I think |
Hi @TysonMN , You are probably really busy, but I wondered if you had a chance already to have a peek at the sample project? Kind regards, Jelle |
Hello Jelle. Yes, still busy. I haven't had a chance to look yet. I will, but I am not sure when right now. Sorry for the long delay. |
Okay, here's an issue. The type signature of
whereas I suspect that you want
(It's So the out-message type is a function when it should be just a message value. All out-message bindings in this list are made using Looking inside Pass a |
@LyndonGingerich oooeeeeh facepalm......... Let me see if this indeed is the case on my main project (pretty large codebase to fix it for) and if I am able to solve it. |
@TysonMN @LyndonGingerich The issue indeed was that I forgot to pass a gridControl to the InOut of confirmStateMessage. So how I solved it was to
Thanks a lot for helping me out. After staring at this for so long I could not see what was wrong. |
Yup, I've been there before. Glad it's figured out! |
@LyndonGingerich, thanks for the help! @minewarriorsSchool, glad you solved your problem. In the future, when you have code that doesn't type check like that, then I suggest you extract pieces to local values. Initially have the type inferred (i.e. use a As an example, consider the code in the screenshot in the above comment by @LyndonGingerich. That is showing a type check error in a list of bindings, so applying the above process involves extacting each binding to its own value. More specifically, consider the SimpleCounter bindings. let bindings () : Binding<Model, Msg> list = [
"CounterValue" |> Binding.oneWay (fun m -> m.Count)
"Increment" |> Binding.cmd Increment
"Decrement" |> Binding.cmd Decrement
"StepSize" |> Binding.twoWay(
(fun m -> float m.StepSize),
int >> SetStepSize)
"Reset" |> Binding.cmdIf(Reset, canReset)
] If this didn't type check, then I am suggesting that could extract one binding at a time to a value...like this: let counterValue = "CounterValue" |> Binding.oneWay (fun m -> m.Count)
let bindings () : Binding<Model, Msg> list = [
counterValue
"Increment" |> Binding.cmd Increment
"Decrement" |> Binding.cmd Decrement
"StepSize" |> Binding.twoWay(
(fun m -> float m.StepSize),
int >> SetStepSize)
"Reset" |> Binding.cmdIf(Reset, canReset)
] and then (possibly) give it a type annotation like this let counterValue : Binding<Model, Msg> = "CounterValue" |> Binding.oneWay (fun m -> m.Count)
let bindings () : Binding<Model, Msg> list = [
counterValue
"Increment" |> Binding.cmd Increment
"Decrement" |> Binding.cmd Decrement
"StepSize" |> Binding.twoWay(
(fun m -> float m.StepSize),
int >> SetStepSize)
"Reset" |> Binding.cmdIf(Reset, canReset)
] Hopefully you typically write code by making small(ish) changes. In that case, you will start with an existing list of bindings that does type check and then adding a new binding causes things to not type check. Then you should extract that binding first. Also, it is helpful to remember that F# infers the type of a list by the first element in the list. So let x = [ "foo", 0 ] has inferred type let x = [ 0, "foo" ] has inferred type let x = [ 0, 1, 2, 3, 4, 5 ] and then added let x = [ "foo", 0, 1, 2, 3, 4, 5 ] then the inferred type is now |
So I currently have a small issue with my current program after making a change that cleaned up my model by removing UI objects from it.
However, this change resulting in changing my mapOutMsg for my subModelWindows from (just one example)
let mapOutMsg = function | ReplaceResourceWindowOutMsg.Close -> CloseReplaceResourceWindow'(false,) | ReplaceResourceWindowOutMsg.CloseDataChanged -> CloseReplaceResourceWindow'(true,)
to
let mapOutMsg = function | ReplaceResourceWindowOutMsg.Close gridControl-> CloseReplaceResourceWindow'(false, gridControl) | ReplaceResourceWindowOutMsg.CloseDataChanged gridControl -> CloseReplaceResourceWindow'(true, gridControl)
When changing this, my bindings in my bindings functions turned all red with the following example:
I am not sure on how I would go about this and fix this.
for your idea why I need that gridControl passed to it is becuse of the following example:
Hopefully you can help me out figuring out how I can fix this.
The text was updated successfully, but these errors were encountered: