|
| [WD19] How to add Content to a Created Control |
| Iniciado por guest, 19,mar. 2015 23:09 - 10 respuestas |
| |
| | | |
|
| |
| Publicado el 19,marzo 2015 - 23:09 |
How would I load in memory content from a file to a created control(c)?
c is Control c <- ControlCreate("Combo1",typComboNE,0,0,100,24,True)
I want to be able to add First and Last name from employee file. If it were a static control the content description would be:
Browsed file: Employee Column Displayed : COL_LastName Stored item: EmployeeID Search item: LastName |
| |
| |
| | | |
|
| | |
| |
| Publicado el 19,marzo 2015 - 23:35 |
Hello Curtis,
you are looking for the indirection mechanism using the {ControlName,indcontrol}=value syntax Look it up in the help, it's extremely powerful
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 20,marzo 2015 - 13:42 |
Hi Curtis,
Adding to what Fabrice said, using the new "Control" variable makes you able to directly access the field properties. Simply look at the help.
c is Control c <- ControlCreate("Combo1",typComboNE,0,0,100,24,True) // Loop in your employee file ListAdd(c,"Employee Name"+gLink(EmployeeID)) // End Loop gLinkActivate(c) // Other examples: c..X = 100 c..Y = 200 c..Value = 10 // For ID #10 or simply c = 10 You can also take a look at the ..Content property.
Best regards, Alexandre Leclerc |
| |
| |
| | | |
|
| | |
| |
| Publicado el 20,marzo 2015 - 15:19 |
Awesome. Thanks. Now if I can just get ..Process and ChangeStyle() to work I'll be in business.
How does ..Process work? I can't get this to work, nor do I see how you would pass in parameters as it throws an error when adding the parenthesis.
c..Process[trtInit] = GetEmployees // GetEmployees() is local procedure of window |
| |
| |
| | | |
|
| | |
| |
| Publicado el 20,marzo 2015 - 15:34 |
Hi Curtis,
GetEmployees must not receive parameters. Use globals if you want to do that. But I suspect your code is not organized efficiently if you need to use the trInit process as so (or you are doing stuff you should not - trInit is called upon creation of the control so it would be useless afterward).
Also, do not forget that if you use the same query for many COMBO controls you must create as many different queries because one query will "feed them all" so to say. You probably do not want that.
For ChangeStyle, in version 20 you will be able to use the ..Style property. Otherwise, you must create a template to your project as described in this post: <a class="ExternalLink" rel="nofollow" target="_blank" href="http://27130.foren.mysnip.de/read.php?27131,514495,514505#msg-514505">http://27130.foren.mysnip.de/read.php…</a>
Best regards, Alexandre Leclerc |
| |
| |
| | | |
|
| | |
| |
| Publicado el 20,marzo 2015 - 15:57 |
Hi Curtis
and to add to Alexandre's answer...
You are trying to set the INIT process of a field... In the regular INIT process of a field, there is no parameter allowed (nor would it make any sense, as it is a fixed process done once) Therefore, there is no reason or mechanism to pass parameters to a dynamic init process
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 23,marzo 2015 - 21:07 |
Why can't I get this code to work on my End of Init process for a window? The control displays, but I can not click it/use it. However, if I place the code in a button on the form and click the button I can think access the created control.
c is Control c <- ControlCreate("Combo1",typComboNE,6,263,200,24,True) c..CaptionWidth = 50 c..Caption = "Employee 1"
dsResult is Data Source sMyQry is string = "SELECT stuff" IF HExecuteSQLQuery(dsResult,sMyQry) THEN HReadFirst(dsResult) WHILE HFound(dsResult) ListAdd(c, dsResult.FirstName + " " + dsResult.LastName + gLink(dsResult.EmployeeID)) HReadNext(dsResult) END END gLinkActivate(c) c = 4; |
| |
| |
| | | |
|
| | |
| |
| Publicado el 23,marzo 2015 - 21:17 |
Hi Curtis,
Good question. What is the ..State of the control? Try making it ..State = Active. Can it get the focus when you click it? As far as I know I'.m creating buttons in the same process and they are clickable.
A simply bypass would be to create your controls in a procedure and make this procedure a timer which is launch right after init. But this is not a nice solution.
Best regards, Alexandre Leclerc |
| |
| |
| | | |
|
| | |
| |
| Publicado el 23,marzo 2015 - 21:21 |
| I've tried ..State = Active. I'd really like to find a way without the timer. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 23,marzo 2015 - 22:16 |
| For the time being I'm going to switch to one static control, and then clone (ControlClone()) it. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 24,marzo 2015 - 13:09 |
Hi Curtis,
By the way, drop an email to the Free Technical Support to report your issue with a small program example (if it is not already done).
Best regards, Alexandre Leclerc |
| |
| |
| | | |
|
| | | | |
| | |
|