ComboBox vs. ComboboxList function

ComboBox vs. ComboboxList function - Differences between the two and syntax - Сообщения

#1 Опубликовано: 06.07.2018 15:31:10
Dionysios J. Pantazis

Dionysios J. Pantazis

16 сообщений из 179 понравились пользователям.

Группа: User

Greetings all-

I am trying to implement either a Combobox or ComboBoxList. I can not determine which one is best suited for my application.

The only discussion I can find is for List-
https://en.smath.info/forum/yaf_postst2491_ComboBoxList-Region.aspx

Is there something for plain ComboBox? I tried searching the forum, wiki and the samples, but no luck.

I am trying to calc a wind force coefficient based on if the object is flat or round- here is what I have come up with so far.



I feel like there might be a better or cleaner syntax.

Why would you choose one over the other? Can anyone suggest an alternate or better method for doing this?

Thanks in advance

Dennis
Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#2 Опубликовано: 06.07.2018 18:23:33
sergio

sergio

115 сообщений из 329 понравились пользователям.

Группа: User

Two partially contradictory aspects do not convince me:
First calculate all the values ​​(2 in your example) but only one you need. In general, it could be very expensive in some cases.
Also use the same variable name for the array and for the output value from the combobox. This way you will no longer have the calculated values ​​available for any further evaluation.
I prefer to create a function with several variables to be used if necessary. I used the "cases" function (of the Custom Functions plugin by Davide Carpi) but you can also use if ... else...)
You can still use the combobox to select a parameter and assign it to a variable to be used in the function.
sergio
[albumimg]1486[/albumimg]
#3 Опубликовано: 08.07.2018 23:29:37
Dionysios J. Pantazis

Dionysios J. Pantazis

16 сообщений из 179 понравились пользователям.

Группа: User

Car_Sample.sm (12 КиБ) скачан 104 раз(а).PompelmoTell-

I did not consider as you suggested for defining it as a custome fuction. I am confused by the "#" in your example. Can you direct me to reference so I can understand the syntax? I thought we could define the inputs and create the function as

function(a, b, c)=a^2+2*b+c

I tried to do this logic by trying to implement the "line" function but could not get it to work. I only could get it to work with if-then statments.

I did not consider the effect of calculating both conditions. I do not know what kind of overheaad that may generate but your point is very much appreciated.

I am not sure that I understand what you mean by using the same value for the variable and the array name. It may be that it was only how I got it to work a the time, I will attempt to revise it.

I may have 4-25 different components to evaluate within the same Page, so I am trying to define the variable and call it up time and time again. Typically, I will insert a 'Seperator' into the document to start a new physical page, and then define the next antenna or device dimensions, manually indexing the i'th values, and computing the Car, then the Area and so forth to get F.i fo the item.

Here is an example of how it was done with MathCad- https://imgur.com/r4AZAAJ . (I have tried to edit out the extraneous info and only include the relavent calculation and logic for Ca).

MathCAd example

Attached is my curent snippet - https://imgur.com/ojZEdLb

As you can see, its a bit ugly. I have attached the code in the snippet as well. Car_Sample.sm (12 КиБ) скачан 104 раз(а).

Car Calc Logic

My hope is to ultimatly be able to define a matrix either in Excel or within SMath to then compute the values in bulk. My programming skills are weak and I am doing my best learning little by little as I go.

I think your suggestion will work out better than manually doing it page by page. I need to come up with a loop to read the lines of the array and do the calculation.

I would appreciate any other suggestions you may have.

Dennis






Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#4 Опубликовано: 09.07.2018 08:33:40
sergio

sergio

115 сообщений из 329 понравились пользователям.

Группа: User

Dennis,
# It's just a character like the others. I use it to distinguish the variables of functions in their definition.
You used the C.AR variable a first time to evaluate a matrix. Right after that you used the same variable name as the ComboBox output and would associate one of the matrix values. At this point for all subsequent operations you have destroyed the initial matrix.

sergio
1 пользователям понравился этот пост
Dionysios J. Pantazis 09.07.2018 12:42:00
#5 Опубликовано: 09.07.2018 18:59:48
Dionysios J. Pantazis

Dionysios J. Pantazis

16 сообщений из 179 понравились пользователям.

Группа: User

Sergio-

I got the variables redefined properly. I see what you mean now.

I had some difficulty with the cases function- I could not figure out how to get another entry in the list. I though it might use the handle like in matrix or line function, but could not figure it out. I ended up copying the 3 line example but would really prefer to learn it properly. Any tips on adding or removing lines to the function?

I also broke apart the page into 2 and put all the matricies and equations into another page that i am calling with an include statement- it makes for a much cleaner end result.

Dennis
Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#6 Опубликовано: 10.07.2018 05:46:00
sergio

sergio

115 сообщений из 329 понравились пользователям.

Группа: User

at the end of the line insert twice arguments separator (";" or "," depending on the settings)

sergio
#7 Опубликовано: 03.08.2018 13:24:40
Dionysios J. Pantazis

Dionysios J. Pantazis

16 сообщений из 179 понравились пользователям.

Группа: User

How can we insert another line into the cases function?
I can not seem to get the cursor in the right place to add another case.

For the life of me, I can not find the custom function plugin forum page or example worksheet. Can anyone give me some tips?

Thanks
Dennis
Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#8 Опубликовано: 03.08.2018 14:24:51
Arie

Arie

93 сообщений из 285 понравились пользователям.

Группа: User

anywhere within the cases() function just hit the comma twice. You are really adding two arguments.... the result, and the condition.

Edit: I said comma, but I should say your argument separator which could be a semi-colon depending on your settings.
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
1 пользователям понравился этот пост
Dionysios J. Pantazis 03.08.2018 20:05:00
#9 Опубликовано: 03.08.2018 20:05:14
Dionysios J. Pantazis

Dionysios J. Pantazis

16 сообщений из 179 понравились пользователям.

Группа: User

thanks, i was only inserting one separator.
Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#10 Опубликовано: 04.08.2018 09:51:10
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

thanks, i was only inserting one separator.



Another virtue of the coma

IntSuite.PNG
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений