Page 1 of 1
pass data from dialog/frame to main form

Posted:
02 Jun 2014 03:40
by fuandi
hi, i'm still beginner with cgdevtool and intraweb. I want to build an application that required to open a pop up window and pass a data/variable value back to main window. I guess I can do this with frame/dialog. But can anyone help me on how to do this ?
This is the scenario.
In the main form/window, I have empty edit box and a button. When i click the button, a pop up window/dialog appear, inside the pop up window there is a grid with list of country in the world, after I selected the the country and press ok button, pop up window will be closed and then the edit text in the main window will show the country that i selected.
In this case, I need to pass a string to the main window. How to do this ?
Re: pass data from dialog/frame to main form

Posted:
02 Jun 2014 10:04
by Jorge Sousa
Hi
The simple way is to create the frame with the form as owner.
procedure TIWMyForm.DoSomething;
begin
MyFrame:= TMyFrame.Create(Self);
end;
And in the frame unit, add the form unit to the implementation uses clause, and typecast it.
implementation
uses
MyForm;
procedure TMyFrame.DoSomething;
var
Form: TMyForm;
begin
Form:= Owner as TMyForm;
end;
Re: pass data from dialog/frame to main form

Posted:
03 Jun 2014 03:00
by fuandi
hi support team, thanks for the reply.
I can't show my frame. Maybe I missed some configuration ?
These are the steps :
1. add frame into project by file > new > others > choose iwcgjqframe and iwcgjqdialog as frame type
2. on the button click event, i put this
var
FRM: TIWCGJQFrame2;
begin
FRM:= TIWCGJQFrame2.Create(Self);
FRM.Show;
end;
Note : I already set my google chrome to allow pop up for all
I also tried the demo project jqframedialog, i cant show the frame after click the button
Re: pass data from dialog/frame to main form

Posted:
03 Jun 2014 10:45
by Jorge Sousa
That Kind of operation is not supported by Intraweb if the event is ajax
You have to set button.onclick.ajax=false or call
FRM.IWFrameRegion.AjaxReRender // == RenderRegionAsync(FRM.IWFrameRegion);
Re: pass data from dialog/frame to main form

Posted:
04 Jun 2014 02:40
by fuandi
still doesnt solve the problem.
I set ajax to true, and use this code
procedure TIWForm1.IWCGJQButton1JQButtonOptionsClick(Sender: TObject;
AParams: TStringList);
var
FRM: TIWCGJQFrame2;
begin
FRM:= TIWCGJQFrame2.Create(Self);
// FRM.Parent:= WebApplication.ActiveForm as TWinControl;
// FRM.Name:= CGFindUniqueComponentName(Self,'DlgFrm2');
FRM.IWFrameRegion.AjaxReRender;
end;
And when i set ajax to false, i put this code
procedure TIWForm1.IWCGJQButton1JQButtonOptionsClick(Sender: TObject;
AParams: TStringList);
var
FRM: TIWCGJQFrame2;
begin
FRM:= TIWCGJQFrame2.Create(Self);
FRM.Show;
end;
Both doesn't work. The frame doesn't show
Re: pass data from dialog/frame to main form

Posted:
04 Jun 2014 09:27
by Jorge Sousa
Please submit a test case
Re: pass data from dialog/frame to main form

Posted:
04 Jun 2014 09:47
by Jorge Sousa
You forgot to set a Parent
if Button OnClick.Ajax=False
FRM:= TIWCGJQFrame2.Create(Self);
FRM.Parent:= Self;
If Button OnClick.Ajax=True, add this
FRM.IWFrameRegion.AjaxReRender();
You don't need FRM.Show in Intraweb
And by the way: You didn't set a jqueryui theme in your demo.
Re: pass data from dialog/frame to main form

Posted:
05 Jun 2014 10:41
by Alexander Bulei
Hi,
cgdevtools_support wrote:And by the way: You didn't set a jqueryui theme in your demo.
Help topic:
viewtopic.php?f=3&t=1366Best Regards.
Re: pass data from dialog/frame to main form

Posted:
05 Jun 2014 10:55
by fuandi
Thanks, followed your instruction and it's working already.
