rejetto forum

Software => HFS ~ HTTP File Server => Programmers corner => Topic started by: Mars on April 08, 2010, 02:18:11 PM

Title: account hint
Post by: Mars on April 08, 2010, 02:18:11 PM
Bug with mime type confirmed (post from @f2065)


******************************************************
Can you see the difference?

And nevertheless they are not the same groups.

The one is named:  can change password
 
Other one: can change password hello

The idea would be of to show the name in the HINT (event onmouseover)
Title: account hint
Post by: rejetto on April 11, 2010, 02:57:29 PM
The idea would be of to show the name in the HINT (event onmouseover)

i tried, and had problems with it, because the main window is brought to front.
do you have an idea why?
Title: account hint
Post by: Mars on April 12, 2010, 06:43:42 PM
i tried, and had problems with it, because the main window is brought to front.
do you have an idea why?


Quote
optionsdlg.pas
.....
var
  optionsFrm: ToptionsFrm;
  pointedAccount: integer = -1;
implementation

{$R *.dfm}
.....
procedure ToptionsFrm.FormActivate(Sender: TObject);
begin
traymsgBoxChange(NIL);
application.MainForm.Hide;
end;

procedure ToptionsFrm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
application.MainForm.Show();
end;

procedure ToptionsFrm.accountsBoxMouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
with accountsbox do
  begin
  ShowHint:=True;
  pointedAccount:=ItematPos(point(x,y), FALSE);
  end;
end;

procedure ToptionsFrm.accountsPageEnter(Sender: TObject);
begin
accountsbox.setfocus;
end;


main.pas
......

procedure TmainFrm.appEventsShowHint(var HintStr: String;
...

  function connhint():string;
  var
    data: TconnData;
  begin
  result:=if_(HintsForNewcomersChk.checked,
    'This box shows info about current connections');
  data:=pointedConnection();
  if data = NIL then exit;
  result:='Start time: '+DateTimeToStr(data.time)
    +#13'Agent: '+first(data.agent,'<unknown>')
  end; // connhint

  function accountshint():string;
  begin
  result:=optionsfrm.accountsBox.items.Strings[optionsdlg.pointedAccount];
  end;

begin
//canShow:=mainFrm.Active;

if hintinfo.HintControl = optionsfrm.accountsBox then
  begin
  hintinfo.ReshowTimeout:=100;
  hintStr:=accountshint();
  end;

if hintinfo.HintControl = filesBox then
  begin
  hintinfo.ReshowTimeout:=800;
  hintStr:=filehint();
  end;

it's important to add application.MainForm.Hide and application.MainForm.show  to allow the use of hint in another form ;)

It is time to you to simplify the thing :D
Title: Re: account hint
Post by: rejetto on May 03, 2010, 08:46:54 AM
it's sad we must hide the main form, but thank you very much!
Title: Re: account hint
Post by: SilentPliz on May 03, 2010, 09:59:20 AM
Warning rejetto, there remains a huge bug when applying the solution given by Mars.

Right click on a VFS resource > Properties ... > Permissions > Manage accounts > Apply, OK, or Cancel... .

The main form hide the properties form.

It still lacks a bit of code without doubt.

--------------------------------------------

I've succeeded with the beta in french language, with a part of code above... that works ok without bugs and without hiding the main form.

I tried to apply the same thing with official beta. I failed ... there is still a bug somewhere with the beta version in english language. I don't know what causes this bug.

Title: Re: account hint
Post by: rejetto on May 04, 2010, 01:49:40 PM
merde!
Title: Re: account hint
Post by: SilentPliz on May 04, 2010, 01:52:40 PM
 As you say! :-\
Title: Re: account hint
Post by: SilentPliz on May 04, 2010, 03:52:51 PM
Ok .. I completed the Mars's solution... everything seems OK. ;)

You just add this:

filepropDlg.pas:

Quote
procedure TfilepropFrm.goToAccountsBtnClick(Sender: TObject);
begin
filepropFrm.Hide;   // add by SP
showOptions(optionsFrm.accountsPage);
updateAccountsBox();
actionTabsChange(NIL);
filepropFrm.Show;   // add by SP
end;

Obsolete post

Title: Re: account hint
Post by: SilentPliz on May 05, 2010, 09:28:43 AM
Yeaaa! I found why it work on the French version.
No need to hide the main form now.  ;)
I put here all the necessary changes:

Edit: on the french version I putted an checkbox for activate/deactivate, because, in case of short names for all accounts, this option is useless.

Quote
Main.pas:

 end; // connhint

 function accountshint():string;
  begin
  result:=optionsfrm.accountsBox.items.Strings[optionsdlg.pointedAccount];
  end;

begin
//canShow:=mainFrm.Active;

if hintinfo.HintControl = optionsfrm.accountsBox then
  begin
  hintinfo.ReshowTimeout:=100;
  hintStr:=accountshint();
  end;


if hintinfo.HintControl = filesBox then




optionsDlg.pas:

var
  optionsFrm: ToptionsFrm;
  pointedAccount: integer = -1;  
implementation

..........
..........


procedure ToptionsFrm.FormShow(Sender: TObject);
var
  i: integer;
  s: string;
begin
i:=round(mainfrm.images.Height*1.25);  
accountsBox.ItemHeight:= round(i*0.9);  
margin:=i div 10;                                                
// setwindowlong(handle, GWL_HWNDPARENT, 0); // get a taskbar button  Commented by SP
loadValues();
if pageCtrl.activePage <> a2nPage then exit;
s:=mainfrm.ipPointedInLog();
if s = '' then exit;
..........
..........


procedure ToptionsFrm.accountsBoxMouseMove(Sender: TObject; Shift: TShiftState;  
  X, Y: Integer);
begin
with accountsbox do
  begin
  ShowHint:=True;
  pointedAccount:=ItematPos(point(x,y), FALSE);
  end;
end;


Title: Re: account hint
Post by: Mars on May 11, 2010, 09:00:50 PM
The simplest of the solutions to avoid the change of focus on the windows which is engendered by hints

Finally, now it is not necessary any more to mask whatever it is, as I recommended it at the beginning of this topic
 ;)
Quote
procedure TmainFrm.appEventsShowHint(var HintStr: String;
.....

begin
//canShow:=mainFrm.Active;
if  mainfrm.Active and (hintinfo.HintControl = filesBox)  then
  begin
  hintinfo.ReshowTimeout:=800;
  hintStr:=filehint();
  end;
if  mainfrm.Active and (hintinfo.HintControl = connBox) then
  begin
  hintinfo.ReshowTimeout:=800;
  hintStr:=connhint();
  end;
if not hintsForNewcomersChk.checked
and ((hintinfo.hintcontrol = modeBtn)
  or (hintinfo.hintcontrol = menuBtn)
  or (hintinfo.hintcontrol = graphBox))
then hintStr:='';
hintStr:=chop(#0, hintStr); // info past null char are used for extra data storing
canShow:=hintstr > '';
end;
Title: Re: account hint
Post by: rejetto on May 16, 2010, 05:01:46 PM
Yeaaa! I found why it work on the French version.
No need to hide the main form now.  ;)
I put here all the necessary changes:

thank you very much SP, that was it!