<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK v2: Рисование графиков из массива данных]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=18427&amp;type=atom" />
	<updated>2025-08-09T07:49:12Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=18427</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162628#p162628" />
			<content type="html"><![CDATA[<p>Исправлена функция TimeSubMs приводившая к случайной ошибке (тип числовой переменной становился string и был равен &quot;0-1&quot;).<br />Исправлены имена окон дочерних графиков.<br />Добавил (наконец-то) описание класса.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2025-08-09T07:49:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162628#p162628</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162358#p162358" />
			<content type="html"><![CDATA[<p>Потому-что &quot;График 1&quot; это название первого окна где все графики.</p><p>Название можно поменять, укажу это в описании когда руки дойдут.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2025-04-16T16:18:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162358#p162358</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162356#p162356" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alectric пишет:</cite><blockquote><p>Выделяю в отдельные методы только то, что будет вызываться несколько раз</p></blockquote></div><p>Это не совсем верно. Вообще считается, что метод или функция по размеру не должны превышать видимый на одном экране текст. Количество вызовов не имеет значения. Структура должна быть примерно такая:<br /></p><div class="codebox"><pre><code>#Requires AutoHotkey v2

class MyClass
{
    __New() {
        this.FirstMethod()
        this.SecondMethod()
        ; ...
        this.LastMethod()
    }

    FirstMethod() {
 
    }

    SecondMethod() {
        
    }

    LastMethod() {
        
    }
}</code></pre></div><div class="quotebox"><cite>Alectric пишет:</cite><blockquote><p>Запусти пример, затем нажми на кнопку внизу графика &quot;Выбран X&quot;</p></blockquote></div><p>Нажимаю &quot;Выбрать 1&quot;, почему-то появляется график 2, но скрывается кнопка 1:</p><p> <span class="postimg"><img src="https://i.imgur.com/m8Fg9Zd.png" alt="https://i.imgur.com/m8Fg9Zd.png" /></span></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2025-04-16T16:12:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162356#p162356</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162355#p162355" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Логические блоки лучше выделять не комментариями</p></blockquote></div><p>Это не логические блоки, это содержимое метода __New. Выделяю в отдельные методы только то, что будет вызываться несколько раз.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2025-04-16T16:03:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162355#p162355</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162354#p162354" />
			<content type="html"><![CDATA[<p>Запусти пример, затем нажми на кнопку внизу графика &quot;Выбран X&quot; - появится дочерний экземпляр графика, в основном окне этот график станет скрытым.<br />Вообще, уже с этим разобрался... хотя не уверен что правильно сделал.<br />Почитай надписи при наведении на кнопки внизу, может какое-то описание непонятно?</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2025-04-16T16:00:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162354#p162354</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162353#p162353" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alectric пишет:</cite><blockquote><div class="codebox"><pre><code>; Добавление меню
    ; Меню настроек
    this.GraphMenuSettings:=Menu()

    obm:=ObjBindMethod(this,&quot;MenuSave&quot;)
    this.GraphMenuSettings.add(this.mi.MenuSave,obm)

    obm:=ObjBindMethod(this,&quot;MenuLoad&quot;)
    this.GraphMenuSettings.add(this.mi.MenuLoad,obm
...
; Создание основного окна
    this.GuiGraph:=Gui(&quot;+MinSize400x100 +Resize&quot;,this.Name)
    this.GuiGraph.MarginX:=0
    this.GuiGraph.MarginY:=0
...
; Создание окна перехода по времени
    this.GuiGoToT:=Gui(&quot;+owner&quot; this.GuiGraph.Hwnd &quot; -sysmenu -Resize&quot;,&quot;Перейти на время&quot;)
    this.GuiGoToT.SetFont(&quot;s10&quot;)
    this.hTT:=this.GuiGoToT.Add(&quot;DateTime&quot;,&quot;xm+1&quot;,&quot;HH:mm:ss        dd.MM.yyyy&quot;)
    obm:=ObjBindMethod(this,&quot;TTOk&quot;)
...</code></pre></div></blockquote></div><p>Логические блоки лучше выделять не комментариями, а отдельными методами с соответствующими названиями.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2025-04-16T15:59:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162353#p162353</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162352#p162352" />
			<content type="html"><![CDATA[<p>Если деструктор вызывается дважды, значит создаётся ещё один экземпляр, вероятно здесь:<br /></p><div class="codebox"><pre><code>this.Child.Push(Graph())</code></pre></div><div class="quotebox"><cite>Alectric пишет:</cite><blockquote><p>Как сообщить родительскому экземпляру что &quot;этот&quot; экземпляр можно удалять в методе Hide()?</p></blockquote></div><p>Не совсем ясна суть вопроса, поясните, или лучше покажите на простом примере.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2025-04-16T15:54:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162352#p162352</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162351#p162351" />
			<content type="html"><![CDATA[<p>Нет... все-таки деструктор вызывается дважды иногда... выдал ему костыль, вроде стабильно работает.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2025-04-16T15:49:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162351#p162351</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162350#p162350" />
			<content type="html"><![CDATA[<p>Вроде разобрался с двойным вызовом деструктора.</p><p>Как сообщить родительскому экземпляру что &quot;этот&quot; экземпляр можно удалять в методе Hide()? Еще не знаю.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2025-04-16T14:36:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162350#p162350</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162349#p162349" />
			<content type="html"><![CDATA[<p>По непонятной причине, иногда, деструктор вызывается 2 раза... не могу разобраться в чем причина.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2025-04-16T12:32:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162349#p162349</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162348#p162348" />
			<content type="html"><![CDATA[<p>Вернул кнопки. Отобрал &quot;костыль&quot;, деструктор вызывается.<br />Теперь не могу сообразить: как сообщить родительскому экземпляру что &quot;этот&quot; экземпляр можно удалять в методе Hide()?</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2025-04-16T06:21:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162348#p162348</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162347#p162347" />
			<content type="html"><![CDATA[<p>Без кнопок выглядит странно. Бывают такие окна в каких-то приложениях?<br /></p><div class="quotebox"><cite>Alectric пишет:</cite><blockquote><p>Не получилось сделать из-за ссылок на ObjBindMethod. Нигде не нашел как сделать иначе.</p></blockquote></div><div class="codebox"><pre><code>#Requires AutoHotkey v2.0

inst1 := MyClass1()
inst2 := MyClass2()
Sleep 1500
inst1 := &#039;&#039;
inst2 := &#039;&#039;

class MyClass1
{
    __New() {
        this.timer := ObjBindMethod(this, &#039;MyTimer&#039;)
        ObjRelease(ObjPtr(this))
        SetTimer this.timer, -10
    }

    MyTimer() {
        ToolTip &#039;Timer from MyClass1&#039;
    }

    __Delete() {
        ObjAddRef(ObjPtr(this))
        SoundBeep 800
    }
}

class MyClass2
{
    __New() {
        this.clbks := MyClass2.Callbacks()
        this.timer := ObjBindMethod(this.clbks, &#039;MyTimer&#039;)
        SetTimer this.timer, -1000
    }

    __Delete() {
        SoundBeep 1200
    }

    class Callbacks
    {
        MyTimer() {
            ToolTip &#039;Timer from MyClass2&#039;
        }
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2025-04-15T17:50:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162347#p162347</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162346#p162346" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Может лучше заставить __Delete() работать?</p></blockquote></div><p>Попробуй заставить на этом примере:<br /></p><div class="codebox"><pre><code>a:=test()
;a:=a.Delete()  ; раскоментируй чтобы вызвать деструктор
a:=&quot;&quot;

Class test
{
  __Delete()
  {
    msgbox &quot;Деструктор вызван.`n&quot;
  }

  Delete()
  {
    settimer this.obm,0
    this.obm:=&quot;&quot;
  }

  __New()
  {
    this.obm:=ObjBindMethod(this,&quot;f&quot;)
    settimer this.obm,100
  }

  f(*)
  {
    tooltip a_tickcount
  }
}

Esc::exitapp
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2025-04-15T17:41:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162346#p162346</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162345#p162345" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Минимизации и закрытия.</p></blockquote></div><p>По задумке их не должно быть. Может потом переделаю.<br /></p><div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>А если будет создано несколько экземпляров класса, как они будут между собой делить эти значения?</p></blockquote></div><p>Мышка может находиться только в 1 окне одновременно.<br /></p><div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Выглядит, как костыль. Может лучше заставить __Delete() работать?</p></blockquote></div><p>Не получилось сделать из-за ссылок на ObjBindMethod. Нигде не нашел как сделать иначе.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2025-04-15T17:28:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162345#p162345</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: Рисование графиков из массива данных]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162344#p162344" />
			<content type="html"><![CDATA[<p>Ещё такое заметил:<br /></p><div class="codebox"><pre><code>  static WheelUp:=false
  static WheelDown:=false
  static HotKeymW:=0</code></pre></div><p>А если будет создано несколько экземпляров класса, как они будут между собой делить эти значения?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2025-04-15T17:18:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162344#p162344</id>
		</entry>
</feed>
