C ++ Builder first-study and answer (sevente)

zhaozj2021-02-16  55

(Copyright requirements: This article is only authorized to use 9CBS, other personal and websites must not be reproduced, excerpt, if there is special demand to contact the author) 7) How to use?

A: Strictly speaking, the collection of CB is not a class, but a class template. It is used to achieve a collection of this abstract data type. Using it can define an actual set type, its general declaration mode is: typedef set classname; where type is used to specify the type of collection element; minval specifies the minimum value of the collection element; maxval specified The maximum value of the collection element. For example, if we define a collection class named TupPerset, the possible elements of this collection class are 26 uppercase letters, we can define: typedef set tupperset; Apply when we can use this collection class to declare a specific collection object, such as tupper set upperset; 8) Can I tell me what common use or operator does the set class?

A: Of course, the following is some of its common operators and methods: CLEAR method: Clear all elements within the collection object, make the collection empty set; Contains method: Do not contain the specified element in the query collection, its statement: BOOL _FASTCALL Contains Const; Operator-: Two collections are governed, and the result set contains different elements in two collections; Operator *: See the intersection of two collections; Operator : ask two collections Convert; Operator <<: Add an element to the specified collection; Operator >>: Delete a specified element from the collection. In fact, the SET class should be relatively wide, such as determining if we press the left mouse button, you can use the following statement: if (Shift.contains (SSLEFT)). 9) I heard that there is a component that can be triggered in CB, can you tell us about its properties and events?

A: You are talking about the Timer component, which is located in the System Component page of the component column. It is not difficult to use it because his properties, the event is particularly small: Enabled Properties: Boolean type. The default is true, and the timer will trigger the ONTIMER event after a period of time. When this property is changed from False to True, the clock will restart the timing. Interval Property: This property is used to set a ONTIMER event once a long time, in milliseconds. The default is 1000 milliseconds. Ontimer Event: This event is triggered once when the enabled property is set to TRUE, and the time specified by the INTERVAL property is triggered once. 10) It turns out that the Timer component is so simple, but I don't know why it's a way to find a loop statement, can you give an example of an Ontimer event?

转载请注明原文地址:https://www.9cbs.com/read-15527.html

New Post(0)