Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Evaluation - Testing example AddCtrls OI9.4
I have this in a form create event script.
Taken from AddCtrls example exactly.
CtrlArray = ""
// Add the label, placing it in the same place it was added to the form
hWnd = Get_Property(@Window:".LABEL", "HANDLE")
OrigSize = Get_Property(@Window:".LABEL", "ORIG_SIZE")
Convert @FM to @VM in OrigSize
CtrlArray<-1> = hWnd:@VM:OrigSize
// Add the editline, placing it in the same place it was added to the form
hWnd = Get_Property(@Window:".EDITLINE", "HANDLE")
OrigSize = Get_Property(@Window:".EDITLINE", "ORIG_SIZE")
Convert @FM to @VM in OrigSize
CtrlArray<-1> = hWnd:@VM:OrigSize
// Add the controls
call Send_Message(@Window:".OLE_PANEL", "OLE.AddCtrls", CtrlArray)
return 1
The controls are disappearing but not showing in the panel. Panel is named OLE_PANEL.
Is there one more step?
Taken from AddCtrls example exactly.
CtrlArray = ""
// Add the label, placing it in the same place it was added to the form
hWnd = Get_Property(@Window:".LABEL", "HANDLE")
OrigSize = Get_Property(@Window:".LABEL", "ORIG_SIZE")
Convert @FM to @VM in OrigSize
CtrlArray<-1> = hWnd:@VM:OrigSize
// Add the editline, placing it in the same place it was added to the form
hWnd = Get_Property(@Window:".EDITLINE", "HANDLE")
OrigSize = Get_Property(@Window:".EDITLINE", "ORIG_SIZE")
Convert @FM to @VM in OrigSize
CtrlArray<-1> = hWnd:@VM:OrigSize
// Add the controls
call Send_Message(@Window:".OLE_PANEL", "OLE.AddCtrls", CtrlArray)
return 1
The controls are disappearing but not showing in the panel. Panel is named OLE_PANEL.
Is there one more step?
Comments
The form I was using was not set to visible.
When I ran the panel test form, the for I was setting is shown on the desktop but not in the panel.
Just mentioning in case is a clue to what I am stuffing up.
Testing is via 'Test Run' in the form designer
I will make that changed.
With monitor sizes and resolutions these days, I think AddCtrls adds limited value. If you need to use a panel to fit more controls on the form, you've probably got too many controls. One useful purpose I guess would be if you wanted to vary which controls were available to the user depending on some setting. You could have all the possible controls on the window and then use AddCtrls instead of the visible property to display just the ones that are relevant.
I don't know which would be the better approach. It would likely be very much dependant on the desired outcome.
I haven't tried the AddNamedForm method and I see you had problems with it though it should be much the same as SetForm. Maybe just try SetForm and see how you go. I've got to admit, the issue you described with AddNamedForm actually sounds familiar to me (with SetForm) but I don't remember doing anything specific to resolve it so maybe it was a version thing.
No argument with the recommendation to use SetForm versus AddCtrls. But for what it is worth, I have always liked the idea of using AddCtrls to create virtual space as a way to emulate what a browser does. Many of the mobile apps today provide forms for people to fill out (patient agreement forms, professional service agreements, automobile service agreements, etc.) and these always require the user to scroll and navigate to get all the content.
A use case I didn't consider. Probably because I've only ever had one instance where I've been required to do something along those lines and I used the tree control to do it. That worked for me but now I can see the value of AddCtrls.
Thanks for enlightening me.
I used SetForm and it works whereas AddNamedForm doesnt.
The issue I am seeing with SetForm is the form flashing up first before showing in the panel.
The form is set as 'Hidden' but there is code for the create event with a forward event, so I assume that is the cause.
Is there a method to avoid the 'Flash up'