csdesign | Simple examples of concurrent server design in Python
kandi X-RAY | csdesign Summary
kandi X-RAY | csdesign Summary
Simple examples of concurrent server design in Python
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Start listening forever
- Create a new TCP socket
- Main loop for the child process
- Read a descriptor from a UNIX domain socket
- Handles a request
- Write a file descriptor to the socket
csdesign Key Features
csdesign Examples and Code Snippets
Community Discussions
Trending Discussions on csdesign
QUESTION
I have written a component that paints a picture centered at X,Y. At runtime, the component is moved around with a SetXY(X,Y: integer)
procedure.
To acheive this, I calculate what the Left
and Top
values should be in the paint routine and set them accordingly. And all that works just fine.
But when I try to do the initial positioning at design-time, I cannot position the component by dragging it to the desired location.
When I set either the Left
or Top
property via the Object Inspector, it works.
ANSWER
Answered 2021-May-28 at 20:48As Both fpiette and Remy pointed out, overriding the SetBounds
did the trick. When positioning a component in design time via dragging and dropping the component it does not individually set the public Left
and Top
properties. But instead makes a call to the SetBounds
procedure.
QUESTION
Many of my application forms inherit from a base form which loads the saved window size, position and state recorded during FormClose and applies it during FormShow.
The inherited;
line in the descendant version of FormShow is in the usual place at the start of the method, and is generally followed by a fair amount of code that requires the visual components on the form to have been created so they can be manipulated and set up.
The problem I am having is that the form is usually hidden until the end of the descendent FormShow event, which is the expected behaviour, unless the WindowState is being set to wsMaximized in the ancestor class FormShow event. In that case, the form becomes visible as soon as the inherited;
line is executed, and you get to watch as the remaining visual elements get organised.
When setting the WindowState property of a VCL.Forms.TForm, the following code is executed:
...ANSWER
Answered 2020-Dec-15 at 04:22You should not be calling your LoadFromState
procedure either from TBaseForm.FormShow
or TBaseForm.FormActivate
.
TBaseForm.FormShow
is called every time visibility of your form changes from False
to True
.
So for instance if you hide your from when showing another and then show it again after another form is closed TBaseForm.FormShow
will fire and thus you will load form's dimensions and position from the saved state which might not be the same state as of when the form was hidden. User might have moved and resized the from since application was started.
This will lead to form moving its position without users wish to do so and thus it will annoy your users as hell.
Also don't use TBaseForm.FormActivate
as this fires every time Form receives focus. So changing focus from another back to this one will the TBaseForm.FormActivate
and thus change your form dimensions and position to the saved state which might not be teh state when form lost its focus.
The correct place for you to call your LoadFormState
procedure with which you load initial properties of your form is within the forms constructor.
QUESTION
If a function is executed at design-time, and creates a TComponent / TControl descendant with a nil owner, the following code in System.Classes will not call InsertComponent:
...ANSWER
Answered 2020-Apr-04 at 13:25The condition would render False
.
That means for you as component builder that when you apparently intentionally create a (sub-)component without an owner, any reliance on whether that component is being designed by an end user simply should not exist. If it does, you would have to implement a custom "is designing"-state system, but then you better should redesign your requirements.
For overriden components you could call the protected SetDesigning
method yourself.
This all assumes that you are fully aware of creating designtime sub-components without owner generally should be prevented unless you have very compelling reasons not to. Remember that components on the component pallete always should follow the default owner-mechanism.
QUESTION
I'm trying follow what was suggested in this answer, changing this part of Vcl.Forms.pas
:
ANSWER
Answered 2019-Sep-01 at 22:51After the help of comments above (mainly of @Remy Lebeau) follows this code working. I hope that can help someone ahead :-).
QUESTION
We require to replace the blue highlight when we scroll through the items in combo box.
How can we do it?
I tried a sample code to handle the border of the combo drop down, The below is my sample application code.
...ANSWER
Answered 2019-Apr-16 at 16:06I have fixed the issue and it is working as expected. The only thing i did is I have handled OnDrawItem twice, So I have to disable this at component designing.
QUESTION
Hi I have a datagrid control(not datagridview control) placed in a windows form(Vb) it have 10 columns. I am trying to input decimal value in one of the column but it is resetting its value. For ex:
I have 31 in a cell and trying to edit it to 20.5 as soon as i change the cell it resets back to 31. If i input any integer value like 21 it accepts the value.
...ANSWER
Answered 2017-Dec-15 at 07:59You should make sure that the corresponding column of your datatable
is not of an integer type. If the given column is some kind of integer
this condition is then reflected in the datagrid
column and when you enter values with decimals they are casted back to integer
.
QUESTION
Are there any compiler defines or functions/constants/variables that can be used to tell whether some code is being built for a design time package or is being executed from inside the IDE?
We have some code hooks that we setup in the initialization of a unit which is part of a package. We don't want this code to be executed when installing the package in the IDE, only when it's running as part of our application.
For now I have added a compiler define to the design time package which strips out the code but I was wondering if there was a built in compiler define that indicates that this is part of a design time package or if there is some function/constant that can be checked to see if the code is running inside the IDE. Similar to the old if csDesigning in ComponentState then
that people use from inside components.
ANSWER
Answered 2017-Apr-19 at 23:44Are there any compiler defines or functions/constants/variables that can be used to tell whether some code is being built for a design time package or is being executed from inside the IDE?
No.
We have some code hooks that we setup in the initialization of a unit which is part of a package. We don't want this code to be executed when installing the package in the IDE, only when it's running as part of our application.
Then that code does not belong in the unit's initialization
section at all. Move it to a separate function that your application code can call during its startup.
For now I have added a compiler define to the design time package which strips out the code
That implies that your design-time package is directly compiling your run-time code, which it should not be doing at all. Run-time code and design-time code need to be in separate packages. Run-time code does not belong in a design-time package, and design-time code does not belong in a run-time package.
I was wondering if there was a built in compiler define that indicates that this is part of a design time package
There is not. However, if you create separate run-time and design-time packages (as you should be), then your hook code belongs in the run-time package only. The design-time package can require
the run-time package (so it has access to your run-time components), and the run-time package can expose a global variable that the design-time package can set. The run-time code can then ignore whatever it needs to ignore if that variable is set.
QUESTION
When running an application written in C, that uses some dll's written in Delphi XE7, I run into an access violation in the following code, which is in the vcl.forms.pas of the vcl library.
...ANSWER
Answered 2017-Apr-13 at 18:33What you describe should not be possible under normal conditions.
There are only two places in the entire VCL where CM_APPSYSCOMMAND
is sent from:
TWinControl.WMSysCommand()
, which is called when a UI control receives aWM_SYSCOMMAND
message. TheLParam
of theCM_APPSYSCOMMAND
message is never set to 0, it is set to a pointer to theTMessage
record of the originalWM_SYSCOMMAND
message:
QUESTION
This is my first attempt at creating a component, I thought I would start with a very basic LED (light bulb not text), after reading a few articles I came up with the following code (which was working), I closed down the IDE (XE10.1 update2) and when trying to use the component in a new blank empty app the IDE crashes when adding the control can anybody help :
...ANSWER
Answered 2017-Jan-13 at 05:05Lets consider this code:
QUESTION
Using Delphi XE6, I am creating a TdateTimePicker-like control, but for a couple of reasons, I am using a TButtonedEdit which has a TMonthCalendar "embedded" within it. A full bare-bones demo is:
I have got it going as desired with the month calendar being SHOWn when the right button is clicked (with Style=WS_POPUP) and I HIDE it when a selection is made, the user navigates away, ESCapes etc.
...ANSWER
Answered 2017-Jan-08 at 21:22As have been established in the comments to the question, the hint does not stay on the screen indefinitely but it is actually continuously re-shown as soon as it is hidden.
The reason for that is, the VCL assumes the hint control to be a child window, that's because it's Parent
property is not nil. In the case of the code in the question, although the month calendar floats by mutating it to be a popup window, its parent is still the form as far as the VCL knows it. This causes the calculation for the hint rectangle in ActivateHint
procedure of the Application to go wrong. On the other hand, HintMouseMessage
procedure of the Application does not care if the control is parented or not. What happens then is, although you don't move the mouse pointer on the control, VCL infers the mouse pointer continuously leaves the hint boundary and then re-enters.
Here is a simplified reproduction for the problem:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install csdesign
You can use csdesign like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page