Hi
ARegion.Width := 300;
ARegion.Visible := true;
IWFrameRegion.AjaxReRender();
You don't need to use .AjaxReRender for applying changes to these common properties like Region.Width, Region.Visible
When you change this properties, Intraweb takes care of generating the necessary javascript, to be executed in the browser, when these properties change in an ajax/async event.
There are however some operations or property changes that aren't supported in ajax/async events, ie, there's is no javascript generation for that methods/prop changes.
The trick to check is (unfortunatelly), try first without .AjaxReRender, if the changes are applied in browser, and maybe check the browser console to analyse ajax response, and if the changes aren't execute, then we use .AjaxReRender.
But we've to realize that, when using .AjaxReRender, that will rerender the respective control as an whole, in the case, the whole region, which always implies more traffic and more execution time in browser.
Now, about what you intend to you, in this case we need a little help from jQuery itself, because jQuery effects are applied to setting the css style display to none (hide) and block(show). while Intraweb works with css style visibility hidden / visible.
Here's the code. Have fun!
- Code: Select all
procedure TIWForm5.IWAppFormCreate(Sender: TObject);
begin
// Define the effects
IWCGJQRegion1.JQEffects.Effect:= jqeExplode;
IWCGJQRegion1.JQEffects.EffectOptionsExplode.Mode:= jqmShow;
IWCGJQRegion1.JQEffects.EffectOptionsExplode.Pieces:= 10;
end;
procedure TIWForm5.IWCGJQButton1JQButtonOptionsClick(Sender: TObject; AParams: TStringList);
var // Toggle visibily with effects
js: string;
begin
if IWCGJQRegion1.Tag = 0 then
begin
js:= Format('$("#%s").hide(%s);',[IWCGJQRegion1.HTMLName,IWCGJQRegion1.JQEffects.JSon.AsJSon]);
IWCGJQRegion1.Tag:= 1; { Invisible }
end
else
begin
js:= Format('$("#%s").show(%s);',[IWCGJQRegion1.HTMLName,IWCGJQRegion1.JQEffects.JSon.AsJSon]);
IWCGJQRegion1.Tag:= 0; { Visible }
end;
WebApplication.CallBackResponse.AddJavaScriptToExecute(js);
// IWCGJQRegion1.Visible:= not IWCGJQRegion1.Visible;
end;