问题标签 [gtk2hs]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
haskell - 将 Ptr() 转换为 SourceCompletionProvider
我已经部分解决了上一个问题。
现在我可以GObject
通过bindings-gobject
(参见hpase)注册子类型,我可以SourceCompletionProvider
使用c'g_type_add_interface_static函数来实现(但还没有尝试过)。
唯一的问题是Ptr ()
将由返回的转换c'g_object_newv
为gtk2hs
数据类型SourceCompletionProvider
。我该怎么做?有什么提示吗?
SourceCompletionProvider
定义如下:
这个定义是什么意思?为什么它是递归的?提供者是ForeignPtr
提供者——对我来说看起来很奇怪。
谢谢。
解决方案:
haskell - With Haskell and Gtk2hs, how would I create a new widget and associated events?
I have an application that I am working on, and I'm basically self-teaching GUI programming. I asked a fairly involved question over on programmers.stackexchange. This question is about the mechanics of an idea I had not tried.
I have three widgets: a TreeView, a TextField, and a DrawingArea. Each of the three widgets interacts very intimately with events on one necessarily triggering actions on the other. Those three widgets largely do not interact with the rest of the application except (so far) by reading an MVar containing the global application state.
Currently I can think of no case in which the larger application should ever interact directly with any of those three widgets. Further, that identical pattern would be replicated to review other data that has the same form. So, it seems to me that it would make sense to actually bind these three widgets together into a larger composite widget that can interact with GTK's normal event queue. So, for instance
So, the widget would use DataUpdatedEvent to indicate to the rest of the application that something inside MyDataViewWidget changed, and RedrawEvent would tell the widget that it needs to redraw or re-read the source data.
(technically, I have not thought through semantically what the various actions in the composite widget would do... whether the widgets would just have a read-only copy of the application data and need to receive new read-only copies with the RedrawEvent or perhaps the widgets would have the MVar itself and be allowed to change the data in the MVar, etc... I'm just interested at the moment in how to actually do this)
Are there any examples of doing something like this? Basically, what instances do I need to implement to create the new widget and the two signals? I'd prefer to stick to Haskell, but I could drop to C in order to build up the new widget.
haskell - Haskell 中的 GUI 编程 - Ubuntu 上的安装问题
是否有仍然是最新的 GUI 包?
我今天尝试同时安装 wxHaskell 和 gtk2hs,但都因我无法解决的依赖项而失败(wxHaskell 找不到一些 wxWidget 库,并且在尝试 gade 教程时 gtk2hs 在我安装的缺少的 pkg-config libglade2-0 上失败)。
我想这只是我不了解 linux/cabal/package 安装的一些问题,但是是否有最新的教程如何开始(安装)一些用于 Haskell 的 GUI 库?
以下是错误:
和
这真的让我很沮丧-也许有人可以在这里帮助我-谢谢!
haskell - 如何使用 Haskell 和 GIO 读取文件?
例如,这是我使用 Haskell 和 gtk2hs 编写的一小段程序:
该fileRead
方法返回一个FileInputStream
实例,但我无法在文档中的任何地方找到从中读取的方法。GIO中对应的C方法应该是g_input_stream_read
,但是gtk2hs中好像没有实现。
我错过了什么吗?
haskell - 需要另一个事件处理程序(按下按钮) Gtk2Hs
我想在 my 中添加一个功能buttonNewWithLabel
,因此它对按下回车键做出反应,而不仅仅是onClicked
事件。我找不到怎么做,但不应该有那么简单onClicked
吗?
我的代码看起来像这样:
里面有这样的功能Gtk2Hs
吗?或者……还有什么我可以用的吗?
windows-7 - 换色不起作用
我尝试使用以下代码更改小部件的颜色:
它适用于 ubuntu,但不适用于 Windows。
haskell - 不能使用带有haskell的glade xml文件
我不确定我是否应该打个招呼,这是我在这里的第一篇文章。
无论如何,我正在关注gtk2hs 网站上的 glade 教程。代码编译正确,但是当我尝试执行它时出现此错误。
这是我的林间空地文件。
林间空地文件与我的源代码位于同一目录中。源代码与教程中的源代码完全相同。我以前从未与 glade 合作过,所以我不知道出了什么问题。
我不得不将 ghc 从 7.6 降级到 7.4.2。我正在使用 glade 3.14.1,所有其他软件包都是通过 cabal 安装的,因此它们使用的是当前版本。
如果我用glade-interface切换界面,在开始和结束时它仍然会抱怨。
如果用小部件更改所有对象标签,我会得到这个
这样做我得到的错误更少,但它仍然不起作用。
haskell - 在 Gtk2Hs 中使用 DrawingArea 的动画
我在 Haskell 方面没有那么丰富的经验,而且我刚刚开始使用 Gtk2Hs,所以这可能是一个愚蠢的问题。
我Line
定义了以下类型:
我有一个函数可以在 a 上绘制一个Line
s列表DrawingArea
。问题是这个函数Line
同时绘制所有 s 但我想一次绘制一个,两个Line
s 之间有一点延迟。
DrawingArea
暴露时调用此函数:
我考虑过使用 aStateT
来跟踪哪些Line
s 尚未绘制,但我不知道如何实现动画。即使widgetShowAll
每次更改状态后调用,窗口也不会显示,直到mainGUI
被调用。
是否可以创建一个新线程,在drawCanvas
以某种方式处理绘图的同时不断更新状态?如果是这样,有人可以给我看一个这种行为的例子吗?或者有没有更好的方法?
haskell - 使用带有 Graphics.SOE 包的 Haskell Gtk 小部件
我一直在研究Paul Hudak的《Haskell School of Expression 》一书,并使用其相关的基于 gtk 的图形库 Graphics.SOE.Gtk(文档链接)进行小型 2D 绘图实验。
然而,这个库是非常基础的,只有真正具有绘制形状的能力。目前,我正在编写一些需要特定 GUI 小部件(例如按钮和文本框)的程序。我的问题是:是否可以将 SOE 库的绘图功能与gtk2hs中的 GUI 小部件一起使用?例如,能够编写一个程序,我可以在其中单击一个按钮,该按钮会导致程序在同一窗口的另一个容器中绘制三角形。
我已经在网上搜索了一种方法来做到这一点,但大多数教程建议使用 cairo 使用 Gtk 进行任何图形绘制;SOE图形的API看起来是一个相对独立的东西。
user-interface - 当用户停止输入文本时运行函数
我正在使用 Haskell 的gtk2hs库编写一个小型 GUI 应用程序,目前正在使用其中的多行文本框。我有一个功能,当用户对文本框中的文本进行更改时,我想运行它,但不希望他们必须单击按钮来激活它。
此外,因为它是一个相当侵入性和处理密集型的功能(它绘制图形,加载文件等),我希望它不会在用户进行任何更改时触发(这可能可以通过文本缓冲区中的bufferChanged信号来完成) '我猜?)但是当他们在更改之间停止几秒钟时。