Fastreport VCL Setting header visibility on odd pages - delphi

In fastreport VCL 4 is there a way to set headers visibility only on odd pages of report? Found no answer on google, neither on fastreport's site, documentation & forum.

You do it in code. In your page object's OnBeforePrint event, you put some code sort of like this:
procedure PageHeader1OnBeforePrint(Sender: TfrxComponent);
begin
PageHeader1.Visible := (Frac(<Page#> / 2) > 0.01)
end;
Maybe there is an easier way to figure out whether you are on an odd page or not, but I resorted to the Frac function because they don't have a Mod function. In practice, I would probably add that function within my own code and make it accessible within the report.

Related

Delphi - Automating a Website Event

I’m trying to automate the downloading of a report from a website (using a WebBrowser).
I have successfully done so for a report in the past, but now find myself having to select an entity from a dropdown list in order to generate a new table of reports for that entity. I can change the index of the list but it will not generate the table of reports I need.
I used the “inspect” feature on Chrome to debug the code and see where the table is being generated, but my understanding of JavaScript is about 3 shades above non-existent.
It appears that when I click the option, it is firing off an “onChange” event that is not occurring when I simply choose the options (makes sense). So, I am attempting to manually fire off this onChange event, but am admittedly getting in a little over my head with this. It appears I need to do a bit more reading on JavaScript and probably the WebBrowser library in Delphi.
I feel like I am missing a key concept in the relationship between Delphi, HTML, and JavaScript. I'm not even sure if I can fire off the event via Delphi (I need to find a way to emulate an event such that the Listener will pick up the entityChanged event). I'm going in mental circles here trying to wrap my head around this and am hoping that I'm missing something very simple and basic.
My code (breaks on the Element.FireEvent, again the values I ascertained through debugging):
procedure TForm3.runReport;
var
Document : IHTMLDocument2;
Element : IHTMLElement3;
begin
try
Document := Form3.WebBrowser1.Document as IHTMLDocument2;
Element := Document.forms.item('l4iHkfgk6Nk%3D_store_11157_6%2F18%2F2014%2012%3A00%3A00%20AM',NULL) as IHTMLElement3;
Element.FireEvent('entityChanged','Txxxxxxxxxxx (11157),l4iHkfgk6Nk=_store_11157_6/18/2014 12:00:00 AM,February 10 2017,entity');
except
rptSt := 1;
end;
end;
Here is what I found about the Event Listener for the selection:
And here is the function that is called when I debug the event:
I apologize in advance if there is too much ambiguity in this; I tried to be as clear as possible.

RawHeaders.Values in Delphi 2010

I'm using the component in delphi indy idhttp 2010 and I have the following problem, I'm trying to get all the values ​​of rawheaders idHTTP1.Request.RawHeaders.Values ​​['User-Agent'], the only one I know of is user agent and I wonder where I can find the list of values ​​to use in RawHeaders.Values​​.
Does anyone could help me?
Your question can be read in few ways.
You ask about "to get all the values ​​of rawheaders" - that is "read, not modify".
And then you tell about "values ​​to use in RawHeaders.Values​​" - which is "write, not read".
Actually it is hard to guess what did you meant here.
Well, if you want to read all the values that are contained there, you are to start from documentation for idHTTP1.Request: http://www.indyproject.org/docsite/html/TIdEntityHeaderInfo.html
There you click on "properties" link, select "RawHeaders" property and - after reading property RawHeaders: TIdHeaderList; - come to http://www.indyproject.org/docsite/html/TIdHeaderList.html
There you read that RawHeaders - just as expected - are a subclass of TStringList thus you can read it with all the usual TStrings-related methods.
Like
idHTTP1.Request.RawHeaders.SaveToFile('1.txt');
s := idHTTP1.Request.RawHeaders.CommaText;
with idHTTP1.Request.RawHeaders do for i := 0 to Count - 1 do begin s := Strings[i]; ... end;
for s in idHTTP1.Request.RawHeaders do begin ... end;
etc.
Alternatively if you want to write some sane and safe values, you are to start from documentation for idHTTP1.Request: http://www.indyproject.org/docsite/html/TIdEntityHeaderInfo.html
There you can see the link to "Hypertext Transfer Protocol version 1.1" where you can find most of them
Or you can add some custom non-standard headers with "X-" prefix, after testing that your server would not break when found them.
Also note that there are some frequently use though non-standard headers or their parameters, like in content-disposition. Some of them are probably retroactively described by communities like HTML5 working group. Or maybe not,
Also note that there are a number of sub-protocols built on top of HTTP. Like WebDAV. Like file transfer in Gnutella2 protocol, etc. They may add their own custom headers, that were not described in their founding HTTP protocol. Read the documentation on those protocols, you may be interested in (if any).

Virtual TreeView hint not showing

I have set ShowHint to true and HintMode to hmToolTip, but my OnGetHint() event handler doesn't even breakpoint when I hover the cursor over the control.
Any idea what I am doing wrong?
.
Additionally, does anyone have any hints as to good documentation, tutorials, etc? For instance, where do I find out what the various values of the HintMode property actually mean?
The documentation on the website is extremely incomplete, the phrase "Use other resources like the news group or the Delphi Gems message board to find a description" occurs 789 times in the HMTL help - generally where I really need help :-/
[Update] In fact, I'd be willing to use another component, even one less pwerful, if it were documented.
Thanks !
The source code is your best friend with VirtualTree...
TVTHintMode = (
hmDefault, // show the hint of the control
hmHint, // show node specific hint string returned by the application
hmHintAndDefault, // same as hmHint but show the control's hint if no node is concerned
hmTooltip // show the text of the node if it isn't already fully shown
);
I usually use these options to display the hint text of the node
ShowHint := True;
HintAnimation := hatFade;
HintMode := hmHint;
hmTooltip is using the text of the node so it may not call the OnGetHint in that case.

Intraweb question about improperly working (radiobutton)?

HI,
I created 4 radiobuttons in a intraweb application.
One is checked by default, the rest is not.
The belong to the same group called group. (I set the group properly of each TIWradiobutton)
There is twiimage image which has click event. In that click event, I tried to set the radiobuttons.
E.g.
radiobutton1.checked:=true;
The problem is that this sometimes set the radiobutton and sometimes it does not.
I found a fix by setting the rest of radiobuttons.checked to false. That fixed the problem.
I wonder what I did wrong in the first place when I just used one assignment.
Can you tell me if it is a bug in intraweb or I used radiobutton improperly?
Thanks.
just create a IWRadioGroup1(in iwstanderd pallet ) in your form
select IWRadioGroup1 , in the properties panenel dblclick on items
you will get a stringlist editor ,type the captions of your four radiobuttons line by line then click OK
now select your IWImage1 ,goto click events just type th above code
procedure TformMain.IWImage1Click(Sender: TObject);
begin
IWRadioGroup1.ItemIndex := 2 // 2 is the radiobutton number as you typed in stringlist editor
end;
sometimes IW or components build over the IW (e.g TMS suite for IW) have a strange behavior.you can find how it works by looking out in the code, how they manage the java script behind your radio groups.
Also sometimes you must manage the components exactly how Atozed say in their documentation.
Probably isn't the best answer, but if you'll work a lot with IW you'll see that it has a lots of limitations and strange behavior (only if you don't work in their style, which sometimes differs a lot from win32 style).
best regards,

how can i hide TRibbon pages?

i'm using delphi 2009's TRibbon component. certain pages are not relevant depending on the application state. how can i hide a TRibbon page?
RibbonPage1.Visible:=false doesn't really hide the page...
is this maybe not allowed by the spec from microsoft?
thank you for you help!
mp
I do not think you can hide the individual ribbon pages, but you can hide or disable the individual RibbonGroups on the each page.
RibbonGroup1.Enabled := false;
RibbonGroup2.Visible := false;
Microsoft Office disables any groups which are not relevant to the current state. Have a look at these articles from the documentation for more help.
Creating an Application that Uses Ribbon Controls
Adding Commands to the Ribbon
You can't do this presently. It is the Tabs (not the Pages) that need to support visibility and they simply do not.
If you try to manipulate the Tabs themselves you will find the code is very dependent on maintaining the linkage between the pages and the tabs to the point of destroying your pages. I don't think there is a good workaround.
Register it as a bug in Quality Central. Support for "Context" aware tabs/pages is definitely something that should be supported. I imagine quite a few others would vote for it.
In fact this is the only hide/show thing that is handled correctly by that piece of borland crap.
MainRibbon.RemoveTab('TabName');
I am now searching how to hide group and individual actions. Visible = false is not ok, try to resize your form smaller and in the collapsed state all is still there.
maybe, try this: RibbonPage1.Free;
Try this: (Delphi XE6)
MainRibbon.Tabs[RibbonPage.Index].Visible := FALSE;
Then you can make it visible again by
MainRibbon.Tabs[RibbonPage.Index].Visible := TRUE;

Resources