Remy Lebeau

Member since: Tuesday, 18 March 2014
Last login: 19 hours 23 minutes ago
Profile viewed: 2,714 views

Your Rank: 52
Points: 44

Remy Lebeau replied to the topic 'community.idera.com' in the forum. 19 hours 23 minutes ago

Given all of Embarcadero's prior mentions about making a new forum that is supposedly the best of the old Borland/Embaradero forums and the new Embarcadero community forums, and that the Idera forums are hardly that, just an add-on to the existing forum server, I'm really hoping it is just an add-on and a new Embarcadero forum is still in the works. But that is just me. Embaradero has not even announced the new Embarcadero forums on the Idera community.

Read More...

Remy Lebeau replied to the topic 'Records should be able to have paramerless constructors' in the forum. 2 days ago

Mark wrote: On the frustrating (as in "what on earth??") side, when I tried to add a constructor with no parameters, the compiler explicitly said
[dcc32 Error] frmTest.pas(63): E2394 Parameterless constructors not allowed on record types

But that would be very useful.


What you are asking for is coming in the upcoming Delphi 10.3 Rio:

blog.marcocantu.com/blog/2018-november-c...-records-delphi.html

Read More...

Remy Lebeau replied to the topic 'Installing Tokyo 64 bits gives me only 32 bits.' in the forum. 5 days ago

Kai Inge wrote: Perhaps we later will get a Win64 IDE also, if it make any sense to do so.


Possible, but not likely. That would break EVERY 3rd party component/library that currently exists, and require EVERY component/library vendor to release new 64bit design-time packages for their components, IDE editors, OTA plugins, etc. That is a MASSIVE effort to ask of the RAD Studio community.

Kai Inge wrote: The IDE is well functioning as it is.


Exactly, which is why it likely won't be changed to a 64bit process anytime in the near future. Though it is on the current roadmap, at the very end under "Research Areas - Under Consideration".

Read More...

duf thanked Remy Lebeau in topic Reading data from the website 7 days ago
Remy Lebeau replied to the topic 'Webservices PUT - multipart/form-data' in the forum. 7 days ago

Adam wrote: I guess I just have to find a workaround (maybe try to force POST somehow instead of PUT).


It is hard to help you with that without seeing your actual code. But, I find the REST components to be fairly bloated and buggy, so you might consider switching to another HTTP component, such as Indy's TIdHTTP (which has a Post() overload that takes a TIdMultipartFormDataStream as input), or an HTTP client from Synapse or ICS or any number of other 3rd party socket libraries.

Read More...

Emailx45 wrote: New White Paper: Delphi Unicode Migration for Mere Mortals
By: Cary Jensen - May/2011


And, your point is...? That paper is not New, it was published 9 years old (in 2009, not 2011). Most Delphi users have already dealt with the Unicode migration and moved on.

Read More...

Remy Lebeau replied to the topic 'TIdTcpServer listing connected clients using C++' in the forum. 1 week ago

Mark wrote: However, I am interested to know why you say one should avoid using the context list, and instead manage one's own database. could you elucidate a little further?


To avoid blocking the server. The Contexts list is a thread-safe list, so it must be locked and unlocked every time the server needs to add/remove a client context. And far too often, people tend to misuse the Contexts list, or perform lengthy operations while keeping the list locked, etc. Thus causing deadlocks for the server. So, that is why I suggest staying away from the Contexts when possible. Though it does have its uses, when used properly.

Read More...

Remy Lebeau replied to the topic 'Webservices PUT - multipart/form-data' in the forum. 1 week ago

You cannot send a "multipart/form-data" webform submission via a PUT request, only via a POST request. The sole purpose of PUT is to replace a remote resource with new content. So PUT cannot be used for webform processing, only POST can be.

Read More...

Remy Lebeau replied to the topic 'PUT method vs multipart/form data' in the forum. 1 week ago

You can't send a "multipart/form-data" webform via a PUT request, only via a POST request.

Read More...

Marek wrote: As I noted at the beginning of my entry, the TClockLabel component is an example rewritten from the Emabarcadero help and
Your comments on TTimer are rather an alternative way of constructing this component.


Embarcadero's example is wrong on this matter. The Timer is internal to the Clock component, so the Clock component should be the Timer's Owner, not the Clock component's Owner. Otherwise, don't assign an Owner to the Timer at all, and then explicitly free it in the Clock component's destructor. This is basic component management 101 stuff. Whoever wrote that example seems to have forgotten that lesson.

Marek wrote: The same applies to TClockLabelComponentEditor which is just my direct translation of the code in Delphi from the Emabarcadero help into C ++.


Perhaps, but your translation did have some errors in it.

Marek wrote: The most important and crucial for the case is the note regarding the name of the namespace (!). I did not find it in the help.


No, it is not a well-documented fact, but it is a well-known fact amongst component authors who code in C++.

Read More...

Remy Lebeau replied to the topic 'TIdTcpServer listing connected clients using C++' in the forum. 1 week ago

Mark wrote: I am using TidTcpServer from C++
I would like to display a list of connected clients:
Handle, Remote IP etc.
How do I extract all of this information?


You can get that information from properties of the TIdSocketHandle class (Handle, PeerIP, PeerPort, etc), which you can access via the TIdContext::Binding property. The TIdTCPServer::Contexts property stores a list of active TIdContext objects, one for each connected client.

Typically, I would suggest staying away from the Contexts list when you can avoid it. Depending on your actual requirements, it may be worthwhile to access the Binding's values from inside the TIdTCPServer::OnConnect and TIdTCPServer::OnDisconnect events and add/remove them to/from your own list (in a thread-safe manner) that you can display in your UI as needed. But, if you don't need to watch clients in your UI in real-time, if you just need to display a snapshot of available clients at a given moment, then it makes more sense to iterate through the Contexts list on an as-needed basis.

Read More...

Marek wrote: I created the TClockLabel component in C ++ ( docwiki.embarcadero.com/RADStudio/Tokyo/...n_Existing_Component ).


There are a couple of minor mistakes in your component code (not related to your issue):

Marek wrote:

FTimer = new TTimer(Owner);


You should be using 'this' as the Owner:
FTimer = new TTimer(this);

Marek wrote:

FreeAndNil(&FTimer);


You need to use 'delete' instead of FreeAndNil(), since you use 'new' to create the timer object:
delete FTimer;

Or better, just get rid of the destructor altogether, since you are assigning a Owner to the timer object. The Owner will free the timer object for you when the Owner itself is freed (it is safe to manually free an owned component, though).

Marek wrote: I created the editor for this component TClockLabelComponentEditor and the editor for its property TClockLabelPropertyEditor.


A few minor issues in that code too, but also a major issue that is causing your issue:

Marek wrote:

if (DesignerForm->ShowModal()==mrOk)
    ((TClockLabel*)Component)->Format = DesignerForm->ClockLabel1->Format;
Designer->Modified();


Ideally, you should not call Modified() unless something actually changed. Move the call inside the 'if' block:
if (DesignerForm->ShowModal() == mrOk)
{
    ((TClockLabel*)Component)->Format = DesignerForm->ClockLabel1->Format;
    Designer->Modified();
}

Or even:
if (DesignerForm->ShowModal() == mrOk)
{
    if (((TClockLabel*)Component)->Format != DesignerForm->ClockLabel1->Format)
    {
        ((TClockLabel*)Component)->Format = DesignerForm->ClockLabel1->Format;
        Designer->Modified();
    }
}

In the case of TClockLabelPropertyEditor, you don't need to call Modified() yourself, TPropertyEditor::SetStrValue() will handle that for you.

Marek wrote:

DesignerForm->Free();


Again, you need to use 'delete' instead:
delete DesignerForm;

Marek wrote:

namespace Clocklabel
{
	void __fastcall PACKAGE Register()
	{
		TComponentClass classes[1] = {__classid(TClockLabelPropertyEditor)};
		RegisterComponents(L"Samples", classes, 0);

		RegisterComponentEditor(__classid(TClockLabel), __classid(TClockLabelComponentEditor));

		PPropInfo PropInfo = GetPropInfo(__typeinfo(TClockLabel), L"Format");
		RegisterPropertyEditor(*(PropInfo->PropType),  __classid(TClockLabel), L"Format", __classid(TClockLabelPropertyEditor));
	}
}


Your editors' Register() function is declared in the wrong namespace. The namespace must match the unit name or else the IDE won't be able to find it when it loads the package. So change it from Clocklabel to Clocklabeleditors instead.

Also, TClockLabelPropertyEditor is not a component, so you should not be trying to register it with RegisterComponents(), only with RegisterPropertyEditor().
namespace Clocklabeleditors
{
	void __fastcall PACKAGE Register()
	{
		RegisterComponentEditor(__classid(TClockLabel), __classid(TClockLabelComponentEditor));

		PPropInfo PropInfo = GetPropInfo(__typeinfo(TClockLabel), L"Format");
		RegisterPropertyEditor(*(PropInfo->PropType),  __classid(TClockLabel), L"Format", __classid(TClockLabelPropertyEditor));
	}
}


Read More...

Remy Lebeau replied to the topic 'SetLocaleInfo dont work in Win10' in the forum. 1 week ago

fazlicc wrote: After last upgrade win 10 SetLocaleInfo dont work


In what way exactly? Please be more specific.

fazlicc wrote:

SetLocaleInfo(LOCALE_SYSTEM_DEFAULT,  LOCALE_SDECIMAL,'.');


What is the return value of SetLocaleInfo()? If 0, what does GetLastError() then return?

fazlicc wrote:

SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, LongInt(cs1));


You should be using LPARAM instead of Longint:
SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, LPARAM(cs1));

end;

How to solve this
THANKS[/quote]

Read More...

Remy Lebeau replied to the topic 'Set text height and width for pagecontrol' in the forum. 1 week ago

Mikael wrote: In my case I custom draw these Tabs and want to set the width and height manually! How can I do this?


Per MSDN:

About Tab Controls: Owner-Drawn Tabs

If a tab control has the TCS_OWNERDRAWFIXED style, the parent window must paint tabs by processing the WM_DRAWITEM message. The tab control sends this message whenever a tab needs to be painted...
...
To specify the size of items in a tab control, the parent window must process the WM_MEASUREITEM message. Because all tabs in an owner-drawn tab control are the same size, this message is sent only once. There is no tab control style for owner-drawn tabs of varying size. You can also set the width and height of tabs by using the TCM_SETITEMSIZE message.


When the TPageControl.OwnerDraw property is true, it enables the TCS_OWNERDRAWFIXED window style, and handles the WM_DRAWITEM message for you, triggering the TPageControl.OnDrawTab event.

However, TPageControl DOES NOT handle the WM_MEASUREITEM message (bug?), so you will have to either:

- subclass the TPageControl (such as by assigning a custom procedure to its WindowProc property) in order to handle the WM_MEASUREITEM message yourself.

- use the TPageControl.TabWidth and TPageControl.TabHeight properties, which use the TCM_SETITEMSIZE message internally (note: if you set a non-zero TabWidth, it will enable the TCS_FIXEDWIDTH window style).

You are a bit limited in what you can do with owner-drawn tabs (for instance, you can't have multiple tabs with different widths).

Mikael wrote: I also want the scroll buttons (that appear when the tabs dont fit) to be adjusted to the given height!
How can I do this?


There is no option exposed by TPageControl to customize those buttons, they are wholly managed by the OS. However, the buttons belong to a standard Win32 Up-Down control, which you can access using FindWindowEx() and then manipulate that HWND as needed, such as by using SetWindowPos() to change its size as desired, eg:
var
  Wnd: HWND;
  R: TRect;
begin
  Wnd := FindWindowEx(PageControl1.Handle, 0, 'msctls_updown32', nil);
  if Wnd <> 0 then
  begin
    GetWindowRect(Wnd, R);
    R.TopLeft := PageControl1.ScreenToClient(R.TopLeft);
    R.BottomRight := PageControl1.ScreenToClient(R.BottomRight);
    SetWindowPos(Wnd, 0, R.Left, 0, R.Width, PageControl1.TabHeight, SWP_FRAMECHANGED);
  end;


Read More...

Remy Lebeau replied to the topic 'TDateTimePicker OnEnter(DoEnter) override' in the forum. 1 week ago

Comograma wrote:

procedure TOvcNumericField.DoEnter;
begin
  inherited;

  // Some code
end;


That should be TDateTimePicker instead of TOvcNumericField:
procedure TDateTimePicker.DoEnter;
begin
  inherited;

  // Some code
end;

Comograma wrote: But this do not work because if I set a break point debugger at line inherited, it doesn't ever reach that line.


Works fine for me after making the above change.

Read More...

Remy Lebeau replied to the topic 'Reading data from the website' in the forum. 1 week ago

Jacek wrote: And in this example how to put two data yera and mounth in this fildes?


Just like before, you need to post back whichever named input fields are present in the webform and have values assigned to them. And there is quite a few such fields in this webform, MOST of which are hidden fields. So again, you will have to use TIdHTTP::Get() to retrieve the HTML first, then parse out the hidden values, and post them back with whatever addition values you need for the visible input fields.

For example:
String html = IdHTTP1->Get("https://www.nbp.pl/home.aspx?c=/ascx/archa.ascx");

// parse webform values from html as needed...
String formAction = ...; // "action" attribute of the <form> element whose id/name is "F1"
String eventTarget = ...; // "value" attribute of child <input> element whose id/name is "__EVENTTARGET"
String eventArg = ...; // "value" attribute of child <input> element whose id/name is "__EVENTARGUMENT"
String viewState = ...; // "value" attribute of child <input> element whose id/name is "__VIEWSTATE"
String viewStateGenerator = ...; // "value" attribute of child <input> element whose id/name is "__VIEWSTATEGENERATOR"
String previousPage = ...; // "value" attribute of child <input> element whose id/name is "__PREVIOUSPAGE"
String eventValidation = ...; // "value" attribute of child <input> element whose id/name is "__EVENTVALIDATION"
String navBarMainSelectedItem = ...; // "value" attribute of child <input> element whose id/name is "navBarMain_SelectedItem"
String navBarMain_ExpandedList = ...; // "value" attribute of child <input> element whose id/name is "navBarMain_ExpandedList"

// webform values for visible user input fields as needed...
String rok = ...; // "02".."18"
String mies = ...; // "01".."12"

// Javascript sets these webform values when the webform is submitted...
formAction = "https://www.nbp.pl/transfer.aspx?c=/ascx/ListABCH.ascx&Typ=a&p=rok;mies&navid=archa";
eventTarget = "";
eventArg = "";

std::auto_ptr<TStrings> dane(new TStringList);

dane->Add("__EVENTTARGET=" + eventTarget);
dane->Add("__EVENTARGUMENT=" + eventArg);
dane->Values["__VIEWSTATE"] = viewState;
dane->Values["__VIEWSTATEGENERATOR"] = viewStateGenerator;
dane->Add("__VIEWSTATEENCRYPTED=");
dane->Values["__PREVIOUSPAGE"] = previousPage;
dane->Values["__EVENTVALIDATION"] = "false";
dane->Values["navBarMain_SelectedItem"] = navBarMainSelectedItem;
dane->Values["navBarMain_ExpandedList"] = navBarMain_ExpandedList;
dane->Values["rok"] = rok;
dane->Values["mies"] = mies;
dane->Values["ctl25$btAscxSubmit"] = "zaakceptuj!";

std::auto_ptr<TStream> Receive(new TMemoryStream);

IdHTTP1->Request->Referer = "https://www.nbp.pl/home.aspx?c=/ascx/archa.ascx";
IdHTTP1->Post(formAction, dane.get(), Receive.get());

...


Read More...

duf thanked Remy Lebeau in topic Reading data from the website 1 week ago