Virtual TreeView hint not showing - delphi

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.

Related

Error at Delphi : Dataset not in edit or insert mode

Right now I'm struggling to solve a bug that caused by the dataset mode at Delphi (using ADODataset),
details as below for the add button mechanism :
IDMain: =self.DBTextIDUser.Caption+'-'+self.DBEditWorkingDate.Text;
datamodule1.ADODataSetWorkingDetails.Append;
with datamodule1.ADODataSetWorkingDetails do
begin
dbgridworkinghours.Fields[0].AsString := IDMain;
dbgridworkinghours.Fields[7].AsString := self.DBTextIDUser.Caption;
dbgridworkinghours.Fields[8].AsString := self.DBTextName.Caption;
dbgridworkinghours.Fields[9].AsString := self.DBEditWorkingDate.Text;
dbgridworkinghours.Fields[11].AsString := self.DBTextPeriod.caption;
dbgridworkinghours.Fields[10].AsString := self.DBTextToday.Caption;
end;
I already set the adodataset to append mode at the save button :
datamodule1.ADODataSetWorkingDetails.post;
when I click the save button, an error appears that:
The adodataset not in edit/insert mode
I already used this mechanism at the other form and it works
note: I already tried setting the adodataset mode to insert, but still faced the same error
What #kobik said.
Your problem is most likely being caused by something you haven't told us in your q.
I think the important thing is for you to find out how to debug this sort of thing
yourself, so that even if you don't understand the cause, you can at least isolate
it and provide better information when you ask for help here. So I'm going to
outline how to do that.
In your Project Options, check the box "Use Debug DCUs"
Set up two event handlers, for your ADODataSetWorkingDetails's
AfterPost and AfterScroll events, put a some "do nothing" code in both of them
(to stop the IDE removing them). Put a debugger breakpoint on the first line
inside the AfterScroll handler, but not (yet) the AfterScroll one.
Compile and run your program.
You should find that somewhere after you call Append but before you click your
Save button, the debugger stops on your AfterPost breakpoint.
When it does,
go to View | Debug windows | Call stack. This will show you a list of
program lines, the one at the top being the one closest to where the breakpoint
tripped. This will likely be deep inside the VCL's run-time code (which is why
I said to check "Use Debug DCUs". Scroll down the list towards the bottom, and
eventually you should come to a line which is the cause of why Post was called.
If it isn't obvious to you why the AfterPost event was called, put a breakpoint
on your Append line and run the program again. When this breakpoint trips,
put another breakpoint inside your AfterScroll event, resume the program
by pressing F9 and see if the AfterScroll breakpoint is hit. If
it is, again view the Call stack and that should show you why it was called -
if it isn't obvious, then add the contents of tthe Call stack window to your q.
If the cause is obvious, then change your code to avoid it.
The reason I've gone on about the AfterScroll event is that what isn't obvious
is that when your code causes a dataset to scroll, any pending change (because
the dtaset is in dsInsert or dsEdit state will cause the change to be posted
and you will then got the error you've quoted if you try to call Post on the
dataset again. Calling Append initially sets a dataset into dsInsert state, btw.
See if you can at least identify what is causing your dataset to post before
it is supposed to, and let us know in a comment to your q or this answer.
Btw, I strongly recommend that you get out of the habit of using the with construct in your code. Although it may save you a bit of typing, in the long term it will likely make bugs far more likely to happen and far harder to find.
Update TDataSet and its descendants have a State property which is of type TDataSetState (see
DB.Pas). Normally, for browsing data and navigating around the dataset, the
dataset is in dsBrowse state. If you call Edit or Append (or Insert), the dataset
is temporarily put in dsEdit or dsInsert state, respectively. Various routines in DB.Pas
check the dataset state before certain operations are performed and raise an exception if the
DataSet in not in the correct state for the operation to go ahead. It is very, very likely
that it is one of these checks that is giving you the exception.
My original hunch was that your error was occurring because something was happening which
was causing Post to be called, because if Post succeeds, it puts the dataset back into
dsBrowse state, so when clicking your Save button calls Post, the dataset is already
in dsBrowse state. You can, of course, put a breakpoint in TDataSet.Post in DB.Pas
check which state the dataset is actually in when it is called.
There are two other main possibilities for the cause of your exception, namely that
either TDataSet.Cancel or the general Abort method is being called. To investigate
these, put breakpoints on the first lines inside TDataSet.Cancel (in DB.Pas) and
Abort (in SysUtils.Pas). If either of these breakpoints trips between you calling
Append and Post, then you can use the Call Stack view to try and figure
out why execution has reached there.

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.

Unable to get ampersand (&) to display in a Delphi TActionMainMenuBar

I am in need of help trying to get the ampersand character to show up in a Delphi XE6 VCL TActionMainMenuBar. I have come across similar requests on Stack Overflow but none that directly address the problem I am having.
When creating an action in the TActionManager, I need the caption of an action to read Network & Database. I have tried using two ampersands in the caption Network && Database to escape the accelerator which did not work. When I included two ampersands, I ended up with Network _Database (See Screenshot1). I have also set the property of ActionBar > Items > AutoHotKeys to false and ActionMainMenuBar > PersistentHotKeys to false. Doing so did not rectify the my issue.
The one thing I did try out of pure desperation that I thought fixed it was to include four ampersands Network &&&& Database which when ran showed up as Network & Database (See Screenshot2). However during testing, if I were to press Alt to turn on hotkeys and navigate into the menu, the caption of the action would read Network && Database. I tried to include a screenshot of this however since I have less than 10 reputation points Stack Overflow limits my post to two attachments.
If anyone can point me in the right direction of if I have left out some information please let me know. I've run out of ideas on how to fix this and I cannot come across anything similar when searching Google. Thanks in advance for the help.
You can fix it on your form's onshow event
action3.caption := 'Network &&Database';

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